Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/nose/util.rb,
lib/nose/util.rb
Overview
Add simple convenience methods
Instance Method Summary collapse
-
#deep_symbolize_keys ⇒ Object
Convert all the keys of a hash to symbols.
- #inspect ⇒ Object
-
#to_color ⇒ String
Get a colored representation of the object.
Instance Method Details
#deep_symbolize_keys ⇒ Object
Convert all the keys of a hash to symbols
200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/nose/util.rb', line 200 def deep_symbolize_keys return each_with_object({}) do |(k, v), memo| memo[k.to_sym] = v.deep_symbolize_keys memo end if is_a? Hash return each_with_object([]) do |v, memo| memo << v.deep_symbolize_keys memo end if is_a? Array self end |
#inspect ⇒ Object
68 69 70 |
# File 'lib/nose/util.rb', line 68 def inspect Formatador.parse(respond_to?(:to_color) ? to_color : to_s) end |
#to_color ⇒ String
Get a colored representation of the object
74 75 76 |
# File 'lib/nose/util.rb', line 74 def to_color to_s end |