Module: Served::Resource::Attributable

Extended by:
ActiveSupport::Concern
Included in:
Attribute::Base, Base
Defined in:
lib/served/resource/attributable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#attributesArray

Returns the keys for all the defined attributes.

Returns:

  • (Array)

    the keys for all the defined attributes



55
56
57
# File 'lib/served/resource/attributable.rb', line 55

def attributes
  Hash[self.class.attributes.keys.collect { |name| [name, send(name)] }]
end

#initialize(hash = {}) ⇒ Object



50
51
52
# File 'lib/served/resource/attributable.rb', line 50

def initialize(hash = {})
  reload_with_attributes(normalize_keys(hash))
end