Closes the associated database file.
Returns true if the associated database file has been closed.
Returns a new array of all key-value pairs of the database for which block evaluates to true.
Returns true if the database is empty.
Removes all the key-value pairs within gdbm.
Returns a hash created by using gdbm’s values as keys, and the keys as values.
Returns true if the given key k exists within the database. Returns false otherwise.
Returns the first object in the range, or an array of the first n
elements.
(10..20).first #=> 10 (10..20).first(3) #=> [10, 11, 12]
Returns true
if obj
is an element of the range, false
otherwise.
("a".."z").include?("g") #=> true ("a".."z").include?("A") #=> false ("a".."z").include?("cc") #=> false
If you need to ensure obj
is between begin
and end
, use cover?
("a".."z").cover?("cc") #=> true
If begin and end are numeric, include?
behaves like cover?
(1..3).include?(1.5) # => true
Returns true
if obj
is between the begin and end of the range.
This tests begin <= obj <= end
when exclude_end?
is false
and begin <= obj < end
when exclude_end?
is true
.
If called with a Range
argument, returns true
when the given range is covered by the receiver, by comparing the begin and end values. If the argument can be treated as a sequence, this method treats it that way. In the specific case of (a..b).cover?(c...d)
with a <= c && b < d
, the end of the sequence must be calculated, which may exhibit poor performance if c
is non-numeric. Returns false
if the begin value of the range is larger than the end value. Also returns false
if one of the internal calls to <=>
returns nil
(indicating the objects are not comparable).
("a".."z").cover?("c") #=> true ("a".."z").cover?("5") #=> false ("a".."z").cover?("cc") #=> true ("a".."z").cover?(1) #=> false (1..5).cover?(2..3) #=> true (1..5).cover?(0..6) #=> false (1..5).cover?(1...6) #=> true
Returns the value of the case-insensitive flag.
/a/.casefold? #=> false /a/i.casefold? #=> true /(?i:a)/.casefold? #=> false
Returns true if the set contains no elements.
Removes all elements and returns self.
set = Set[1, 'c', :s] #=> #<Set: {1, "c", :s}> set.clear #=> #<Set: {}> set #=> #<Set: {}>
Returns true if the set is a subset of the given set.
Equivalent to Set#keep_if
, but returns nil if no changes were made. Returns an enumerator if no block is given.
Equivalent to Set#select!
Merges the elements of the given enumerable object to the set and returns self.
Resets the internal state after modification to existing elements and returns self.
Elements will be reindexed and deduplicated.
provides a unified clone
operation, for REXML::XPathParser
to use across multiple Object
types
In general, to_sym
returns the Symbol
corresponding to an object. As sym is already a symbol, self
is returned in this case.
Case-insensitive version of Symbol#<=>
. Currently, case-insensitivity only works on characters A-Z/a-z, not all of Unicode. This is different from Symbol#casecmp?
.
:aBcDeF.casecmp(:abcde) #=> 1 :aBcDeF.casecmp(:abcdef) #=> 0 :aBcDeF.casecmp(:abcdefg) #=> -1 :abcdef.casecmp(:ABCDEF) #=> 0
nil
is returned if the two symbols have incompatible encodings, or if other_symbol
is not a symbol.
:foo.casecmp(2) #=> nil "\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil
Returns true
if sym
and other_symbol
are equal after Unicode case folding, false
if they are not equal.
:aBcDeF.casecmp?(:abcde) #=> false :aBcDeF.casecmp?(:abcdef) #=> true :aBcDeF.casecmp?(:abcdefg) #=> false :abcdef.casecmp?(:ABCDEF) #=> true :"\u{e4 f6 fc}".casecmp?(:"\u{c4 d6 dc}") #=> true
nil
is returned if the two symbols have incompatible encodings, or if other_symbol
is not a symbol.
:foo.casecmp?(2) #=> nil "\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp?(:"\u{c4 d6 dc}") #=> nil
Returns whether sym is :“” or not.