Class: CBR::Base
Direct Known Subclasses
Catalog, CatalogItem, Daily::Collection, Daily::Core, Daily::Item, Dynamic::Collection, Dynamic::Core, Dynamic::Item
Instance Method Summary collapse
Instance Method Details
#to_hash ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cbr/base.rb', line 7 def to_hash Hash[instance_variables.map do |name| hasherized_value = instance_variable_get(name) hasherized_value = hasherized_value.to_hash rescue hasherized_value if hasherized_value.is_a?(Array) hasherized_value = hasherized_value.map do |v| v.to_hash rescue v end end [name[1..-1], hasherized_value] end] end |