Results for: "tally"

Equivalent to sym.to_s.capitalize.to_sym.

See String#capitalize.

Allocates space for a new object of class’s class and does not call initialize on the new instance. The returned object must be an instance of class.

klass = Class.new do
  def initialize(*args)
    @initialized = true
  end

  def initialized?
    @initialized || false
  end
end

klass.allocate.initialized? #=> false

Returns true if and only if the current severity level allows for the printing of FATAL messages.

Sets the severity to FATAL.

Log a FATAL message.

See info for more information.

Invokes the block, setting the block’s parameters to the values in params using something close to method calling semantics. Returns the value of the last expression evaluated in the block.

a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
a_proc.call(9, 1, 2, 3)    #=> [9, 18, 27]
a_proc[9, 1, 2, 3]         #=> [9, 18, 27]
a_proc.(9, 1, 2, 3)        #=> [9, 18, 27]
a_proc.yield(9, 1, 2, 3)   #=> [9, 18, 27]

Note that prc.() invokes prc.call() with the parameters given. It’s syntactic sugar to hide “call”.

For procs created using lambda or ->() an error is generated if the wrong number of parameters are passed to the proc. For procs created using Proc.new or Kernel.proc, extra parameters are silently discarded and missing parameters are set to nil.

a_proc = proc {|a,b| [a,b] }
a_proc.call(1)   #=> [1, nil]

a_proc = lambda {|a,b| [a,b] }
a_proc.call(1)   # ArgumentError: wrong number of arguments (given 1, expected 2)

See also Proc#lambda?.

Invokes the meth with the specified arguments, returning the method’s return value.

m = 12.method("+")
m.call(3)    #=> 15
m.call(20)   #=> 32

Generates a Continuation object, which it passes to the associated block. You need to require 'continuation' before using this method. Performing a cont.call will cause the callcc to return (as will falling through the end of the block). The value returned by the callcc is the value of the block, or the value passed to cont.call. See class Continuation for more details. Also see Kernel#throw for an alternative mechanism for unwinding a call stack.

Returns the called name of the current method as a Symbol. If called outside of a method, it returns nil.

Calls the operating system function identified by num and returns the result of the function or raises SystemCallError if it failed.

Arguments for the function can follow num. They must be either String objects or Integer objects. A String object is passed as a pointer to the byte sequence. An Integer object is passed as an integer whose bit size is the same as a pointer. Up to nine parameters may be passed.

The function identified by num is system dependent. On some Unix systems, the numbers may be obtained from a header file called syscall.h.

syscall 4, 1, "hello\n", 6   # '4' is write(2) on our box

produces:

hello

Calling syscall on a platform which does not have any way to an arbitrary system function just fails with NotImplementedError.

Note: syscall is essentially unsafe and unportable. Feel free to shoot your foot. The DL (Fiddle) library is preferred for safer and a bit more portable programming.

Returns the current execution stack—an array containing strings in the form file:line or file:line: in `method'.

The optional start parameter determines the number of initial stack entries to omit from the top of the stack.

A second optional length parameter can be used to limit how many entries are returned from the stack.

Returns nil if start is greater than the size of current execution stack.

Optionally you can pass a range, which will return an array containing the entries within the specified range.

def a(skip)
  caller(skip)
end
def b(skip)
  a(skip)
end
def c(skip)
  b(skip)
end
c(0)   #=> ["prog:2:in `a'", "prog:5:in `b'", "prog:8:in `c'", "prog:10:in `<main>'"]
c(1)   #=> ["prog:5:in `b'", "prog:8:in `c'", "prog:11:in `<main>'"]
c(2)   #=> ["prog:8:in `c'", "prog:12:in `<main>'"]
c(3)   #=> ["prog:13:in `<main>'"]
c(4)   #=> []
c(5)   #=> nil

Returns whether every element meets a given criterion.

With no argument and no block, returns whether every element is truthy:

(1..4).all?           # => true
%w[a b c d].all?      # => true
[1, 2, nil].all?      # => false
['a','b', false].all? # => false
[].all?               # => true

With argument pattern and no block, returns whether for each element element, pattern === element:

(1..4).all?(Integer)                 # => true
(1..4).all?(Numeric)                 # => true
(1..4).all?(Float)                   # => false
%w[bar baz bat bam].all?(/ba/)       # => true
%w[bar baz bat bam].all?(/bar/)      # => false
%w[bar baz bat bam].all?('ba')       # => false
{foo: 0, bar: 1, baz: 2}.all?(Array) # => true
{foo: 0, bar: 1, baz: 2}.all?(Hash)  # => false
[].all?(Integer)                     # => true

With a block given, returns whether the block returns a truthy value for every element:

(1..4).all? {|element| element < 5 }                    # => true
(1..4).all? {|element| element < 4 }                    # => false
{foo: 0, bar: 1, baz: 2}.all? {|key, value| value < 3 } # => true
{foo: 0, bar: 1, baz: 2}.all? {|key, value| value < 2 } # => false

Related: any?, none? one?.

Allocate size bytes of memory and return the integer memory address for the allocated memory.

Change the size of the memory allocated at the memory location addr to size bytes. Returns the memory address of the reallocated memory, which may be different than the address passed in.

Set the default id conversion object.

This is expected to be an instance such as DRb::DRbIdConv that responds to to_id and to_obj that can convert objects to and from DRb references.

See DRbServer#default_id_conv.

Set the default id conversion object.

This is expected to be an instance such as DRb::DRbIdConv that responds to to_id and to_obj that can convert objects to and from DRb references.

See DRbServer#default_id_conv.

No documentation available
No documentation available

Really verbose mode gives you extra output.

Install generated indices into the destination directory.

Return an Array of Specifications contained within the gem_home we’ll be installing into.

No documentation available

Call hooks on installed gems

No documentation available
No documentation available
Search took: 3ms  ·  Total Results: 1169