Module: Representation::ActiveRecord::ClassMethods

Defined in:
lib/representation/active_record.rb

Instance Method Summary collapse

Instance Method Details

#representation(name, *attributes_and_method_names) ⇒ Object



16
17
18
# File 'lib/representation/active_record.rb', line 16

def representation(name, *attributes_and_method_names)
  representations[name] = attributes_and_method_names
end

#representation_namesObject



19
20
21
# File 'lib/representation/active_record.rb', line 19

def representation_names
  representations.keys
end

#values_for_representation(name) ⇒ Object



22
23
24
25
# File 'lib/representation/active_record.rb', line 22

def values_for_representation(name)
  raise UnknownRepresentationError, "Unknown Representation '#{name}'" unless representation_names.include?(name)
  representations[name]
end