Returns true
if this is a permutation matrix Raises an error if matrix is not square.
Version
Parses command line arguments argv
in order when environment variable POSIXLY_CORRECT is set, and in permutation mode otherwise.
Same as parse
, but removes switches destructively. Non-option arguments remain in argv
.
Returns the parameter information of this proc.
prc = lambda{|x, y=42, *other|} prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
Returns the parameter information of this method.
Returns the parameter information of this method.
Parse the JSON
document source into a Ruby data structure and return it.
opts can have the following keys:
max_nesting: The maximum depth of nesting allowed in the parsed data structures. Disable depth checking with :max_nesting => false. It defaults to 100.
allow_nan: If set to true, allow NaN
, Infinity
and -Infinity in defiance of RFC 4627 to be parsed by the Parser. This option defaults to false.
symbolize_names: If set to true, returns symbols for the names (keys) in a JSON
object. Otherwise strings are returned. Strings are the default.
create_additions: If set to false, the Parser doesn’t create additions even if a matching class and create_id
was found. This option defaults to false.
object_class: Defaults to Hash
array_class: Defaults to Array
Parse the JSON
document source into a Ruby data structure and return it. The bang version of the parse method defaults to the more dangerous values for the opts hash, so be sure only to parse trusted source documents.
opts can have the following keys:
max_nesting: The maximum depth of nesting allowed in the parsed data structures. Enable depth checking with :max_nesting => anInteger. The parse! methods defaults to not doing max depth checking: This can be dangerous if someone wants to fill up your stack.
allow_nan: If set to true, allow NaN
, Infinity
, and -Infinity in defiance of RFC 4627 to be parsed by the Parser. This option defaults to true.
create_additions: If set to false, the Parser doesn’t create additions even if a matching class and create_id
was found. This option defaults to false.
Parse a YAML string in yaml
. Returns the Psych::Nodes::Document
. filename
is used in the exception message if a Psych::SyntaxError
is raised.
Raises a Psych::SyntaxError
when a YAML syntax error is detected.
Example:
Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Document:0x00> begin Psych.parse("--- `", "file.txt") rescue Psych::SyntaxError => ex ex.file # => 'file.txt' ex.message # => "(file.txt): found character that cannot start any token" end
See Psych::Nodes
for more information about YAML AST.
URI::parse(uri_str)
uri_str
String with URI
.
Creates one of the URI’s subclasses instance from the string.
Raised if URI given is not a correct one.
require 'uri' uri = URI.parse("http://www.ruby-lang.org/") p uri # => #<URI::HTTP:0x202281be URL:http://www.ruby-lang.org/> p uri.scheme # => "http" p uri.host # => "www.ruby-lang.org"
It’s recommended to first ::escape the provided uri_str
if there are any invalid URI
characters.
The standard configuration object for gems.
Use the given configuration object (which implements the ConfigFile
protocol) as the standard configuration object.
Returns the fractional part of the second.
DateTime.new(2001,2,3,4,5,6.5).sec_fraction #=> (1/2)
Returns the current list of converters in effect for headers. See CSV::new
for details. Built-in converters will be returned by name, while others will be returned as is.
‘get_option’ is an alias of ‘get’.
‘each_option’ is an alias of ‘each’.
List of options that will be supplied to RDoc
Returns true if the set is a proper superset of the given set.
Value from exception raised on the :raise
event
Returns true if the method mid
have an option opt
.
p FileUtils.have_option?(:cp, :noop) #=> true p FileUtils.have_option?(:rm, :force) #=> true p FileUtils.have_option?(:rm, :preserve) #=> false
Returns an Array of option names of the method mid
.
p FileUtils.options_of(:rm) #=> ["noop", "verbose", "force"]
Notify observers of a change in state if this object’s changed state is true
.
This will invoke the method named in add_observer
, passing *arg
. The changed state is then set to false
.
*arg
Any arguments to pass to the observers.
Creates an option parser and fills it in with the help info for the command.