Class: Phlexi::Field::Structure::NamespaceCollection

Inherits:
Node
  • Object
show all
Includes:
Enumerable
Defined in:
lib/phlexi/field/structure/namespace_collection.rb

Instance Attribute Summary

Attributes inherited from Node

#key, #parent

Instance Method Summary collapse

Methods inherited from Node

#inspect

Constructor Details

#initialize(key, parent:, collection: nil, &block) ⇒ NamespaceCollection

Returns a new instance of NamespaceCollection.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
# File 'lib/phlexi/field/structure/namespace_collection.rb', line 9

def initialize(key, parent:, collection: nil, &block)
  raise ArgumentError, "block is required" unless block.present?

  super(key, parent: parent)

  @collection = collection
  @block = block
  each(&block)
end

Instance Method Details

#objectObject



19
20
21
# File 'lib/phlexi/field/structure/namespace_collection.rb', line 19

def object
  @collection
end