Module: Heroku::Model::ModelHelper
Instance Method Summary collapse
Instance Method Details
#identifier ⇒ Object
12 13 14 |
# File 'lib/heroku/model/model_helper.rb', line 12 def identifier identifiable.to_a.map { |k,v| "#{k}=#{v.inspect}"}.join(', ') end |
#struct_init_from_hash(hash) ⇒ Object
4 5 6 |
# File 'lib/heroku/model/model_helper.rb', line 4 def struct_init_from_hash(hash) hash.values_at(*members.map(&:to_s)) end |
#sub_struct_as_hash(*params) ⇒ Object
8 9 10 |
# File 'lib/heroku/model/model_helper.rb', line 8 def sub_struct_as_hash(*params) Hash[(params & members).map { |k| [k, send(k)] }] end |