Module: Hoss::NaivelyHashable Private
- Included in:
- Stacktrace::Frame
- Defined in:
- lib/hoss/naively_hashable.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #naively_hashable? ⇒ Boolean private
- #to_h ⇒ Object private
Instance Method Details
#naively_hashable? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/hoss/naively_hashable.rb', line 23 def naively_hashable? true end |
#to_h ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hoss/naively_hashable.rb', line 27 def to_h instance_variables.each_with_object({}) do |name, h| key = name.to_s.delete('@').to_sym value = instance_variable_get(name) is_hashable = value.respond_to?(:naively_hashable?) && value.naively_hashable? h[key] = is_hashable ? value.to_h : value end end |