Class: Nodes::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/buho_cfdi/nodes/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Collection

Returns a new instance of Collection.



5
6
7
8
# File 'lib/buho_cfdi/nodes/collection.rb', line 5

def initialize(klass)
  @klass = klass
  @_collection = []
end

Instance Attribute Details

#_collectionObject

Returns the value of attribute _collection.



3
4
5
# File 'lib/buho_cfdi/nodes/collection.rb', line 3

def _collection
  @_collection
end

#klassObject

Returns the value of attribute klass.



3
4
5
# File 'lib/buho_cfdi/nodes/collection.rb', line 3

def klass
  @klass
end

Instance Method Details

#add(params) ⇒ Object



14
15
16
17
18
19
# File 'lib/buho_cfdi/nodes/collection.rb', line 14

def add(params)
  instance = klass.new(params)
  _collection << instance

  instance
end

#allObject



10
11
12
# File 'lib/buho_cfdi/nodes/collection.rb', line 10

def all
  _collection
end