Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/gumdrop/util/core_ex.rb

Instance Method Summary collapse

Instance Method Details

#ends_with?(string) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/gumdrop/util/core_ex.rb', line 15

def ends_with?(string)
  self[0..(string.length)] == string
end

#starts_with?(string) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/gumdrop/util/core_ex.rb', line 19

def starts_with?(string)
  self[0..(string.length)] == string
end

#to_hash_objectObject



11
12
13
# File 'lib/gumdrop/util/core_ex.rb', line 11

def to_hash_object
  Gumdrop::Util::HashObject.from self
end

#to_symbolized_hashObject



5
6
7
8
9
# File 'lib/gumdrop/util/core_ex.rb', line 5

def to_symbolized_hash
  new_hash= {}
  self.each {|k,v| new_hash[k.to_sym]= v }
  new_hash
end