Returns whether the [fixed-anchor property] is set.
Creates GUID.
WIN32OLE.create_guid # => {1CB530F1-F6B1-404D-BCE6-1959BF91F4A8}
Calls the given block with each value; returns self
:
h = {foo: 0, bar: 1, baz: 2} h.each_value {|value| puts value } # => {:foo=>0, :bar=>1, :baz=>2}
Output:
0 1 2
Returns a new Enumerator
if no block given:
h = {foo: 0, bar: 1, baz: 2} e = h.each_value # => #<Enumerator: {:foo=>0, :bar=>1, :baz=>2}:each_value> h1 = e.each {|value| puts value } h1 # => {:foo=>0, :bar=>1, :baz=>2}
Output:
0 1 2
Calls the given block with each key; returns self
:
h = {foo: 0, bar: 1, baz: 2} h.each_key {|key| puts key } # => {:foo=>0, :bar=>1, :baz=>2}
Output:
foo bar baz
Returns a new Enumerator
if no block given:
h = {foo: 0, bar: 1, baz: 2} e = h.each_key # => #<Enumerator: {:foo=>0, :bar=>1, :baz=>2}:each_key> h1 = e.each {|key| puts key } h1 # => {:foo=>0, :bar=>1, :baz=>2}
Output:
foo bar baz
Calls the given block with each key-value pair; returns self
:
h = {foo: 0, bar: 1, baz: 2} h.each_pair {|key, value| puts "#{key}: #{value}"} # => {:foo=>0, :bar=>1, :baz=>2}
Output:
foo: 0 bar: 1 baz: 2
Returns a new Enumerator
if no block given:
h = {foo: 0, bar: 1, baz: 2} e = h.each_pair # => #<Enumerator: {:foo=>0, :bar=>1, :baz=>2}:each_pair> h1 = e.each {|key, value| puts "#{key}: #{value}"} h1 # => {:foo=>0, :bar=>1, :baz=>2}
Output:
foo: 0 bar: 1 baz: 2
Returns a new Array
containing values for the given keys
:
h = {foo: 0, bar: 1, baz: 2} h.values_at(:baz, :foo) # => [2, 0]
The default values are returned for any keys that are not found:
h.values_at(:hello, :foo) # => [nil, 0]
Yields each environment variable name and its value as a 2-element Array:
h = {} ENV.each_pair { |name, value| h[name] = value } # => ENV h # => {"bar"=>"1", "foo"=>"0"}
Returns an Enumerator
if no block given:
h = {} e = ENV.each_pair # => #<Enumerator: {"bar"=>"1", "foo"=>"0"}:each_pair> e.each { |name, value| h[name] = value } # => ENV h # => {"bar"=>"1", "foo"=>"0"}
Yields each environment variable name:
ENV.replace('foo' => '0', 'bar' => '1') # => ENV names = [] ENV.each_key { |name| names.push(name) } # => ENV names # => ["bar", "foo"]
Returns an Enumerator
if no block given:
e = ENV.each_key # => #<Enumerator: {"bar"=>"1", "foo"=>"0"}:each_key> names = [] e.each { |name| names.push(name) } # => ENV names # => ["bar", "foo"]
Yields each environment variable value:
ENV.replace('foo' => '0', 'bar' => '1') # => ENV values = [] ENV.each_value { |value| values.push(value) } # => ENV values # => ["1", "0"]
Returns an Enumerator
if no block given:
e = ENV.each_value # => #<Enumerator: {"bar"=>"1", "foo"=>"0"}:each_value> values = [] e.each { |value| values.push(value) } # => ENV values # => ["1", "0"]
Returns an Array
containing the environment variable values associated with the given names:
ENV.replace('foo' => '0', 'bar' => '1', 'baz' => '2') ENV.values_at('foo', 'baz') # => ["0", "2"]
Returns nil
in the Array
for each name that is not an ENV
name:
ENV.values_at('foo', 'bat', 'bar', 'bam') # => ["0", nil, "1", nil]
Returns an empty Array
if no names given.
Raises an exception if any name is invalid. See Invalid Names and Values.
Returns an enumerator which iterates over each line (separated by sep, which defaults to your platform’s newline character) of each file in ARGV
. If a block is supplied, each line in turn will be yielded to the block, otherwise an enumerator is returned. The optional limit argument is an Integer
specifying the maximum length of each line; longer lines will be split according to this limit.
This method allows you to treat the files supplied on the command line as a single file consisting of the concatenation of each named file. After the last line of the first file has been returned, the first line of the second file is returned. The ARGF.filename
and ARGF.lineno
methods can be used to determine the filename of the current line and line number of the whole input, respectively.
For example, the following code prints out each line of each named file prefixed with its line number, displaying the filename once per file:
ARGF.each_line do |line| puts ARGF.filename if ARGF.file.lineno == 1 puts "#{ARGF.file.lineno}: #{line}" end
While the following code prints only the first file’s name at first, and the contents with line number counted through all named files.
ARGF.each_line do |line| puts ARGF.filename if ARGF.lineno == 1 puts "#{ARGF.lineno}: #{line}" end
Iterates over each byte of each file in ARGV
. A byte is returned as an Integer
in the range 0..255.
This method allows you to treat the files supplied on the command line as a single file consisting of the concatenation of each named file. After the last byte of the first file has been returned, the first byte of the second file is returned. The ARGF.filename
method can be used to determine the filename of the current byte.
If no block is given, an enumerator is returned instead.
For example:
ARGF.bytes.to_a #=> [35, 32, ... 95, 10]
Iterates over each codepoint of each file in ARGF
.
This method allows you to treat the files supplied on the command line as a single file consisting of the concatenation of each named file. After the last codepoint of the first file has been returned, the first codepoint of the second file is returned. The ARGF.filename
method can be used to determine the name of the file in which the current codepoint appears.
If no block is given, an enumerator is returned instead.
Serialization support for the object returned by _getobj_.
Reinitializes delegation from a serialized object.
Creates a new compiler for ERB
. See ERB::Compiler.new for details
Returns true if the ipaddr is an IPv4-mapped IPv6 address.
Returns true if the ipaddr is an IPv4-compatible IPv6 address.
Returns a new ipaddr built by converting the native IPv4 address into an IPv4-mapped IPv6 address.
Returns a new ipaddr built by converting the native IPv4 address into an IPv4-compatible IPv6 address.
Returns the wildcard mask in string format e.g. 0.0.255.255
Returns the Ruby source filename and line number of the binding object.
Returns match and captures at the given indexes
, which may include any mixture of:
Integers.
Ranges.
Names (strings and symbols).
Examples:
m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie") # => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8"> m.values_at(0, 2, -2) # => ["HX1138", "X", "113"] m.values_at(1..2, -1) # => ["H", "X", "8"] m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2") # => #<MatchData "1 + 2" a:"1" op:"+" b:"2"> m.values_at(0, 1..2, :a, :b, :op) # => ["1 + 2", "1", "+", "1", "2", "+"]