Class: SimpleAMS::Document::Folder

Inherits:
SimpleAMS::Document show all
Includes:
Enumerable
Defined in:
lib/simple_ams/document.rb

Instance Attribute Summary collapse

Attributes inherited from SimpleAMS::Document

#embedded_options, #options, #resource, #serializer

Instance Method Summary collapse

Methods inherited from SimpleAMS::Document

#adapter, #document?, #embedded, #fields, #folder?, #forms, #generics, #links, #metas, #name, #primary_id, #relations, #type

Constructor Details

#initialize(options, embedded_options = nil) ⇒ Folder

Returns a new instance of Folder.



93
94
95
96
97
98
99
100
# File 'lib/simple_ams/document.rb', line 93

def initialize(options, embedded_options = nil)
  @_options = options
  @embedded_options = embedded_options
  @options = @_options.collection_options

  @members = options.collection
  @resource = options.resource
end

Instance Attribute Details

#membersObject (readonly)

Returns the value of attribute members.



90
91
92
# File 'lib/simple_ams/document.rb', line 90

def members
  @members
end

Instance Method Details

#documentsObject

do we really need this method ?



113
114
115
# File 'lib/simple_ams/document.rb', line 113

def documents
  each.map
end

#eachObject



102
103
104
105
106
107
108
109
110
# File 'lib/simple_ams/document.rb', line 102

def each
  return enum_for(:each) unless block_given?

  members.each do |resource|
    yield SimpleAMS::Document.new(options_for(resource))
  end

  self
end

#resource_optionsObject



117
118
119
# File 'lib/simple_ams/document.rb', line 117

def resource_options
  _options
end