Module: Heroku::Model::ModelHelper

Included in:
Account, App
Defined in:
lib/heroku/model/model_helper.rb

Instance Method Summary collapse

Instance Method Details

#identifierObject



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