Class: MasterDataTool::MasterDataCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/master_data_tool/master_data_collection.rb

Instance Method Summary collapse

Constructor Details

#initializeMasterDataCollection

Returns a new instance of MasterDataCollection.



5
6
7
# File 'lib/master_data_tool/master_data_collection.rb', line 5

def initialize
  @collection = []
end

Instance Method Details

#append(master_data:) ⇒ Object



9
10
11
# File 'lib/master_data_tool/master_data_collection.rb', line 9

def append(master_data:)
  @collection << master_data
end

#eachObject



13
14
15
16
17
18
19
# File 'lib/master_data_tool/master_data_collection.rb', line 13

def each
  return enum_for(:each) unless block_given?

  @collection.sort_by(&:basename).each do |master_data|
    yield master_data
  end
end

#to_aObject



21
22
23
# File 'lib/master_data_tool/master_data_collection.rb', line 21

def to_a
  each.to_a
end