Results for: "strip"

Returns true for IPv6 multicast organization-local scope address. It returns false otherwise.

Returns true for IPv6 multicast global scope address. It returns false otherwise.

Returns IO instance tied to ARGF for writing if inplace mode is enabled.

No documentation available

Prints all threads in @thread_list to @stdout. Returns a sorted array of values from the @thread_list hash.

While in the debugger you can list all of the threads with: DEBUGGER__.thread_list_all

(rdb:1) DEBUGGER__.thread_list_all
+1 #<Thread:0x007fb2320c03f0 run> debug_me.rb.rb:3
 2 #<Thread:0x007fb23218a538@debug_me.rb.rb:3 sleep>
 3 #<Thread:0x007fb23218b0f0@debug_me.rb.rb:3 sleep>
[1, 2, 3]

Your current thread is indicated by a +

Additionally you can list all threads with th l

(rdb:1) th l
 +1 #<Thread:0x007f99328c0410 run>  debug_me.rb:3
  2 #<Thread:0x007f9932938230@debug_me.rb:3 sleep> debug_me.rb:3
  3 #<Thread:0x007f9932938e10@debug_me.rb:3 sleep> debug_me.rb:3

See DEBUGGER__ for more usage.

No documentation available

Returns the value of the local variable symbol.

def foo
  a = 1
  binding.local_variable_get(:a) #=> 1
  binding.local_variable_get(:b) #=> NameError
end

This method is the short version of the following code:

binding.eval("#{symbol}")

Set local variable named symbol as obj.

def foo
  a = 1
  bind = binding
  bind.local_variable_set(:a, 2) # set existing local variable `a'
  bind.local_variable_set(:b, 3) # create new local variable `b'
                                 # `b' exists only in binding

  p bind.local_variable_get(:a)  #=> 2
  p bind.local_variable_get(:b)  #=> 3
  p a                            #=> 2
  p b                            #=> NameError
end

This method behaves similarly to the following code:

binding.eval("#{symbol} = #{obj}")

if obj can be dumped in Ruby code.

Returns true if a local variable symbol exists.

def foo
  a = 1
  binding.local_variable_defined?(:a) #=> true
  binding.local_variable_defined?(:b) #=> false
end

This method is the short version of the following code:

binding.eval("defined?(#{symbol}) == 'local-variable'")

Breaks the buffer into lines that are shorter than maxwidth

Raises PStore::Error if the calling code is not in a PStore#transaction or if the code is in a read-only PStore#transaction.

Re-composes a prime factorization and returns the product.

See Prime#int_from_prime_division for more details.

Returns the directories in the current shell’s PATH environment variable as an array of directory names. This sets the system_path for all instances of Shell.

Example: If in your current shell, you did:

$ echo $PATH
/usr/bin:/bin:/usr/local/bin

Running this method in the above shell would then return:

["/usr/bin", "/bin", "/usr/local/bin"]

Sets the system_path that new instances of Shell should have as their initial system_path.

path should be an array of directory name strings.

Convenience method for Shell::CommandProcessor.def_system_command. Defines an instance method which will execute the given shell command. If the executable is not in Shell.default_system_path, you must supply the path to it.

Shell.def_system_command('hostname')
Shell.new.hostname # => localhost

# How to use an executable that's not in the default path

Shell.def_system_command('run_my_program', "~/hello")
Shell.new.run_my_program # prints "Hello from a C program!"

Convenience method for Shell::CommandProcessor.undef_system_command

Returns the value of a thread local variable that has been set. Note that these are different than fiber local values. For fiber local values, please see Thread#[] and Thread#[]=.

Thread local values are carried along with threads, and do not respect fibers. For example:

Thread.new {
  Thread.current.thread_variable_set("foo", "bar") # set a thread local
  Thread.current["foo"] = "bar"                    # set a fiber local

  Fiber.new {
    Fiber.yield [
      Thread.current.thread_variable_get("foo"), # get the thread local
      Thread.current["foo"],                     # get the fiber local
    ]
  }.resume
}.join.value # => ['bar', nil]

The value “bar” is returned for the thread local, where nil is returned for the fiber local. The fiber is executed in the same thread, so the thread local values are available.

Sets a thread local with key to value. Note that these are local to threads, and not to fibers. Please see Thread#thread_variable_get and Thread#[] for more information.

Establishes proc on thr as the handler for tracing, or disables tracing if the parameter is nil.

See Kernel#set_trace_func.

Adds proc as a handler for tracing.

See Thread#set_trace_func and Kernel#set_trace_func.

The Kernel#require from before RubyGems was loaded.

Establishes proc as the handler for tracing, or disables tracing if the parameter is nil.

Note: this method is obsolete, please use TracePoint instead.

proc takes up to six parameters:

proc is invoked whenever an event occurs.

Events are:

c-call

call a C-language routine

c-return

return from a C-language routine

call

call a Ruby method

class

start a class or module definition

end

finish a class or module definition

line

execute code on a new line

raise

raise an exception

return

return from a Ruby method

Tracing is disabled within the context of proc.

  class Test
  def test
    a = 1
    b = 2
  end
  end

  set_trace_func proc { |event, file, line, id, binding, classname|
     printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
  }
  t = Test.new
  t.test

    line prog.rb:11               false
  c-call prog.rb:11        new    Class
  c-call prog.rb:11 initialize   Object
c-return prog.rb:11 initialize   Object
c-return prog.rb:11        new    Class
    line prog.rb:12               false
    call prog.rb:2        test     Test
    line prog.rb:3        test     Test
    line prog.rb:4        test     Test
  return prog.rb:4        test     Test

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

Sets the last win32 Error of the current executing Thread to error

Starts tracing object allocations from the ObjectSpace extension module.

For example:

require 'objspace'

class C
  include ObjectSpace

  def foo
    trace_object_allocations do
      obj = Object.new
      p "#{allocation_sourcefile(obj)}:#{allocation_sourceline(obj)}"
    end
  end
end

C.new.foo #=> "objtrace.rb:8"

This example has included the ObjectSpace module to make it easier to read, but you can also use the ::trace_object_allocations notation (recommended).

Note that this feature introduces a huge performance decrease and huge memory consumption.

Search took: 9ms  ·  Total Results: 1729