Results for: "strip"

Returns a string for DNS reverse lookup compatible with RFC3172.

Returns a string for DNS reverse lookup compatible with RFC1886.

Returns the names of the binding’s local variables as symbols.

def foo
  a = 1
  2.times do |n|
    binding.local_variables #=> [:a, :n]
  end
end

This method is the short version of the following code:

binding.eval("local_variables")
No documentation available
No documentation available
No documentation available

Returns the sharing detection flag as a boolean value. It is false (nil) by default.

Sets the sharing detection flag to b.

Returns the portion of the original string after the current match. Equivalent to the special variable $'.

m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie")
m.post_match   #=> ": The Movie"

Raises PStore::Error if the calling code is not in a PStore#transaction.

List of options that will be supplied to RDoc

Returns the original name of the method.

class C
  def foo; end
  alias bar foo
end
C.instance_method(:bar).original_name # => :foo

Returns the original name of the method.

class C
  def foo; end
  alias bar foo
end
C.instance_method(:bar).original_name # => :foo

Returns an array of the names of the thread-local variables (as Symbols).

thr = Thread.new do
  Thread.current.thread_variable_set(:cat, 'meow')
  Thread.current.thread_variable_set("dog", 'woof')
end
thr.join               #=> #<Thread:0x401b3f10 dead>
thr.thread_variables   #=> [:dog, :cat]

Note that these are not fiber local variables. Please see Thread#[] and Thread#thread_variable_get for more details.

Returns true if the given string (or symbol) exists as a thread-local variable.

me = Thread.current
me.thread_variable_set(:oliver, "a")
me.thread_variable?(:oliver)    #=> true
me.thread_variable?(:stanley)   #=> false

Note that these are not fiber local variables. Please see Thread#[] and Thread#thread_variable_get for more details.

Returns the execution stack for the target thread—an array containing backtrace location objects.

See Thread::Backtrace::Location for more information.

This method behaves similarly to Kernel#caller_locations except it applies to a specific thread.

In general, while a TracePoint callback is running, other registered callbacks are not called to avoid confusion by reentrance. This method allows the reentrance in a given block. This method should be used carefully, otherwise the callback can be easily called infinitely.

If this method is called when the reentrance is already allowed, it raises a RuntimeError.

Returns an array of the names of global variables. This includes special regexp global variables such as $~ and $+, but does not include the numbered regexp global variables ($1, $2, etc.).

global_variables.grep /std/   #=> [:$stdin, :$stdout, :$stderr]

Controls tracing of assignments to global variables. The parameter symbol identifies the variable (as either a string name or a symbol identifier). cmd (which may be a string or a Proc object) or block is executed whenever the variable is assigned. The block or Proc object receives the variable’s new value as a parameter. Also see Kernel::untrace_var.

trace_var :$_, proc {|v| puts "$_ is now '#{v}'" }
$_ = "hello"
$_ = ' there'

produces:

$_ is now 'hello'
$_ is now ' there'

Removes tracing for the specified command on the given global variable and returns nil. If no command is specified, removes all tracing for that variable and returns an array containing the commands actually removed.

Returns the names of the current local variables.

fred = 1
for i in 1..10
   # ...
end
local_variables   #=> [:fred, :i]

Calls the given block with each element, converting multiple values from yield to an array; returns self:

a = []
(1..4).each_entry {|element| a.push(element) } # => 1..4
a # => [1, 2, 3, 4]

a = []
h = {foo: 0, bar: 1, baz:2}
h.each_entry {|element| a.push(element) }
# => {:foo=>0, :bar=>1, :baz=>2}
a # => [[:foo, 0], [:bar, 1], [:baz, 2]]

class Foo
  include Enumerable
  def each
    yield 1
    yield 1, 2
    yield
  end
end
Foo.new.each_entry {|yielded| p yielded }

Output:

1
[1, 2]
nil

With no block given, returns an Enumerator.

No documentation available

Returns the last Error of the current executing Thread or nil if none

Sets the last Error of the current executing Thread to error

Search took: 4ms  ·  Total Results: 1486