Module: Simplifyapi::CollectionRepresenter::ClassMethods

Defined in:
lib/simplifyapi/collection_representer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



18
19
20
# File 'lib/simplifyapi/collection_representer.rb', line 18

def collection
  @collection
end

Instance Method Details

#export(collection) ⇒ Object



30
31
32
# File 'lib/simplifyapi/collection_representer.rb', line 30

def export collection
  @representation.export(self, collection)
end

#representation(&block) ⇒ Object



24
25
26
27
28
# File 'lib/simplifyapi/collection_representer.rb', line 24

def representation &block
  return @representation unless block_given?

  @representation = Representation.new &block
end

#representer(representer_klass) ⇒ Object



20
21
22
# File 'lib/simplifyapi/collection_representer.rb', line 20

def representer representer_klass
  @collection = Collection.new(name, representer_klass)
end

#represents_collection?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/simplifyapi/collection_representer.rb', line 38

def represents_collection?
  true
end

#represents_model?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/simplifyapi/collection_representer.rb', line 34

def represents_model?
  false
end