Results for: "module_function"

(see Action.action_name)

(see Action.action_name)

(see Action#name)

Adds the given action to the log, running the action @param [DependencyGraph] graph @param [Action] action @return The value returned by ‘action.up`

(see Action.action_name)

Creates a string representation of self, by calling inspect on each element.

[ "a", "b", "c" ].to_s     #=> "[\"a\", \"b\", \"c\"]"

Array Difference

Returns a new array that is a copy of the original array, removing all occurrences of any item that also appear in other_ary. The order is preserved from the original array.

It compares elements using their hash and eql? methods for efficiency.

[ 1, 1, 2, 2, 3, 3, 4, 5 ].difference([ 1, 2, 4 ])     #=> [ 3, 3, 5 ]

Note that while 1 and 2 were only present once in the array argument, and were present twice in the receiver array, all occurrences of each Integer are removed in the returned array.

Multiple array arguments can be supplied and all occurrences of any element in those supplied arrays that match the receiver will be removed from the returned array.

[ 1, 'c', :s, 'yep' ].difference([ 1 ], [ 'a', 'c' ])  #=> [ :s, "yep" ]

If you need set-like behavior, see the library class Set.

See also Array#-.

Prepends objects to the front of self, moving other elements upwards. See also Array#shift for the opposite effect.

a = [ "b", "c", "d" ]
a.unshift("a")   #=> ["a", "b", "c", "d"]
a.unshift(1, 2)  #=> [ 1, 2, "a", "b", "c", "d"]

Returns a new array containing the items in self for which the given block is not true. The ordering of non-rejected elements is maintained.

See also Array#delete_if

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

Deletes every element of self for which the block evaluates to true, if no changes were made returns nil.

The array may not be changed instantly every time the block is called.

See also Enumerable#reject and Array#delete_if.

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

Returns true if the given object is present in self (that is, if any element == object), otherwise returns false.

a = [ "a", "b", "c" ]
a.include?("b")   #=> true
a.include?("z")   #=> false

Returns a new array by removing duplicate values in self.

If a block is given, it will use the return value of the block for comparison.

It compares values using their hash and eql? methods for efficiency.

self is traversed in order, and the first occurrence is kept.

a = [ "a", "a", "b", "b", "c" ]
a.uniq   # => ["a", "b", "c"]

b = [["student","sam"], ["student","george"], ["teacher","matz"]]
b.uniq {|s| s.first}   # => [["student", "sam"], ["teacher", "matz"]]

Removes duplicate elements from self.

If a block is given, it will use the return value of the block for comparison.

It compares values using their hash and eql? methods for efficiency.

self is traversed in order, and the first occurrence is kept.

Returns nil if no changes are made (that is, no duplicates are found).

a = [ "a", "a", "b", "b", "c" ]
a.uniq!   # => ["a", "b", "c"]

b = [ "a", "b", "c" ]
b.uniq!   # => nil

c = [["student","sam"], ["student","george"], ["teacher","matz"]]
c.uniq! {|s| s.first}   # => [["student", "sam"], ["teacher", "matz"]]

Returns a copy of self with all nil elements removed.

[ "a", nil, "b", nil, "c", nil ].compact
                  #=> [ "a", "b", "c" ]

Removes nil elements from the array.

Returns nil if no changes were made, otherwise returns the array.

[ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ]
[ "a", "b", "c" ].compact!           #=> nil

Returns the number of elements.

If an argument is given, counts the number of elements which equal obj using ==.

If a block is given, counts the number of elements for which the block returns a true value.

ary = [1, 2, 4, 2]
ary.count                  #=> 4
ary.count(2)               #=> 2
ary.count {|x| x%2 == 0}   #=> 3

See also Enumerable#none?

See also Enumerable#one?

provides a unified clone operation, for REXML::XPathParser to use across multiple Object+ types

provides a unified clone operation, for REXML::XPathParser to use across multiple Object types

No documentation available

Produces a shallow copy of obj—the instance variables of obj are copied, but not the objects they reference. clone copies the frozen (unless :freeze keyword argument is given with a false value) state of obj. See also the discussion under Object#dup.

class Klass
   attr_accessor :str
end
s1 = Klass.new      #=> #<Klass:0x401b3a38>
s1.str = "Hello"    #=> "Hello"
s2 = s1.clone       #=> #<Klass:0x401b3998 @str="Hello">
s2.str[1,4] = "i"   #=> "i"
s1.inspect          #=> "#<Klass:0x401b3a38 @str=\"Hi\">"
s2.inspect          #=> "#<Klass:0x401b3998 @str=\"Hi\">"

This method may have class-specific behavior. If so, that behavior will be documented under the #initialize_copy method of the class.

Returns object. This method is deprecated and will be removed in Ruby 3.2.

Returns object. This method is deprecated and will be removed in Ruby 3.2.

Returns false. This method is deprecated and will be removed in Ruby 3.2.

Search took: 6ms  ·  Total Results: 3881