Results for: "pstore"

Evaluates a string containing Ruby source code, or the given block, within the context of the receiver (obj). In order to set the context, the variable self is set to obj while the code is executing, giving the code access to obj’s instance variables and private methods.

When instance_eval is given a block, obj is also passed in as the block’s only argument.

When instance_eval is given a String, the optional second and third parameters supply a filename and starting line number that are used when reporting compilation errors.

class KlassWithSecret
  def initialize
    @secret = 99
  end
  private
  def the_secret
    "Ssssh! The secret is #{@secret}."
  end
end
k = KlassWithSecret.new
k.instance_eval { @secret }          #=> 99
k.instance_eval { the_secret }       #=> "Ssssh! The secret is 99."
k.instance_eval {|obj| obj == self } #=> true

Executes the given block within the context of the receiver (obj). In order to set the context, the variable self is set to obj while the code is executing, giving the code access to obj’s instance variables. Arguments are passed as block parameters.

class KlassWithSecret
  def initialize
    @secret = 99
  end
end
k = KlassWithSecret.new
k.instance_exec(5) {|x| @secret+x }   #=> 104

Returns self.

No documentation available

Returns a new hash with the results of running the block once for every key. This method does not change the values.

h = { a: 1, b: 2, c: 3 }
h.transform_keys {|k| k.to_s }  #=> { "a" => 1, "b" => 2, "c" => 3 }
h.transform_keys(&:to_s)        #=> { "a" => 1, "b" => 2, "c" => 3 }
h.transform_keys.with_index {|k, i| "#{k}.#{i}" }
                                #=> { "a.0" => 1, "b.1" => 2, "c.2" => 3 }

If no block is given, an enumerator is returned instead.

Invokes the given block once for each key in hsh, replacing it with the new key returned by the block, and then returns hsh. This method does not change the values.

h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s }  #=> { "a" => 1, "b" => 2, "c" => 3 }
h.transform_keys!(&:to_sym)      #=> { a: 1, b: 2, c: 3 }
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
                                 #=> { "a.0" => 1, "b.1" => 2, "c.2" => 3 }

If no block is given, an enumerator is returned instead.

Returns a new hash with the results of running the block once for every value. This method does not change the keys.

h = { a: 1, b: 2, c: 3 }
h.transform_values {|v| v * v + 1 }  #=> { a: 2, b: 5, c: 10 }
h.transform_values(&:to_s)           #=> { a: "1", b: "2", c: "3" }
h.transform_values.with_index {|v, i| "#{v}.#{i}" }
                                     #=> { a: "1.0", b: "2.1", c: "3.2" }

If no block is given, an enumerator is returned instead.

Invokes the given block once for each value in hsh, replacing it with the new value returned by the block, and then returns hsh. This method does not change the keys.

h = { a: 1, b: 2, c: 3 }
h.transform_values! {|v| v * v + 1 }  #=> { a: 2, b: 5, c: 10 }
h.transform_values!(&:to_s)           #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
                                      #=> { a: "2.0", b: "5.1", c: "10.2" }

If no block is given, an enumerator is returned instead.

Creates a hash with a copy of the environment variables.

Returns an IO object representing the current file. This will be a File object unless the current file is a stream such as STDIN.

For example:

ARGF.to_io    #=> #<File:glark.txt>
ARGF.to_io    #=> #<IO:<STDIN>>

Reads at most maxlen bytes from the ARGF stream in non-blocking mode.

Returns true if headers will be returned as a row of results. See CSV::new for details.

Returns true if all output fields are quoted. See CSV::new for details.

This method is an encoding safe version of Regexp::escape(). It will escape any characters that would change the meaning of a regular expression in the encoding of str. Regular expression characters that cannot be transcoded to the target encoding will be skipped and no escaping will be performed if a backslash cannot be transcoded.

Builds a regular expression in @encoding. All chunks will be transcoded to that encoding.

Builds a String in @encoding. All chunks will be transcoded to that encoding.

Returns the list of break points where execution will be stopped.

See DEBUGGER__ for more usage

No documentation available

Returns a new binding each time near TOPLEVEL_BINDING for runs that do not specify a binding.

Set an error (a protected method).

Return the appropriate error message in POSIX-defined format. If no error has occurred, returns nil.

Creates a new ipaddr containing the given network byte ordered string form of an IP address.

Creates a Range object for the network address.

Set date-time format.

datetime_format

A string suitable for passing to strftime.

Returns the date format being used. See datetime_format=

Search took: 5ms  ·  Total Results: 3363