Class: Stepmod::Utils::ChangeCollection
- Inherits:
- 
      Object
      
        - Object
- Stepmod::Utils::ChangeCollection
 
- Defined in:
- lib/stepmod/utils/change_collection.rb
Instance Method Summary collapse
- #count ⇒ Object (also: #size)
- #each(&block) ⇒ Object
- #fetch(change, type) ⇒ Object
- #fetch_or_initialize(change, type) ⇒ Object
- 
  
    
      #initialize(stepmod_dir:)  ⇒ ChangeCollection 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ChangeCollection. 
- #save_to_files ⇒ Object
Constructor Details
#initialize(stepmod_dir:) ⇒ ChangeCollection
Returns a new instance of ChangeCollection.
| 6 7 8 9 | # File 'lib/stepmod/utils/change_collection.rb', line 6 def initialize(stepmod_dir:) @stepmod_dir = stepmod_dir @changes = {} end | 
Instance Method Details
#count ⇒ Object Also known as: size
| 30 31 32 | # File 'lib/stepmod/utils/change_collection.rb', line 30 def count @changes.keys.count end | 
#each(&block) ⇒ Object
| 35 36 37 | # File 'lib/stepmod/utils/change_collection.rb', line 35 def each(&block) @changes.values.each(&block) end | 
#fetch(change, type) ⇒ Object
| 21 22 23 24 | # File 'lib/stepmod/utils/change_collection.rb', line 21 def fetch(change, type) schema = schema_name(change) @changes[schema_identifier(schema, type)] end | 
#fetch_or_initialize(change, type) ⇒ Object
| 11 12 13 14 15 16 17 18 19 | # File 'lib/stepmod/utils/change_collection.rb', line 11 def fetch_or_initialize(change, type) schema = schema_name(change) @changes[schema_identifier(schema, type)] ||= Change.new( type: type, stepmod_dir: @stepmod_dir, schema_name: schema, ) end | 
#save_to_files ⇒ Object
| 26 27 28 | # File 'lib/stepmod/utils/change_collection.rb', line 26 def save_to_files @changes.each_value(&:save_to_file) end |