Class: RailsDevelopmentBoost::LoadedFile::ConstantsToFiles

Inherits:
Hash
  • Object
show all
Defined in:
lib/rails_development_boost/loaded_file.rb

Instance Method Summary collapse

Instance Method Details

#associate(const_name, file) ⇒ Object



77
78
79
# File 'lib/rails_development_boost/loaded_file.rb', line 77

def associate(const_name, file)
  (self[const_name] ||= []) << file
end

#deassociate(const_name, file) ⇒ Object



81
82
83
84
85
86
# File 'lib/rails_development_boost/loaded_file.rb', line 81

def deassociate(const_name, file)
  if files = self[const_name]
    files.delete(file)
    delete(const_name) if files.empty?
  end
end

#each_file_with_const(const_name, &block) ⇒ Object



88
89
90
91
92
# File 'lib/rails_development_boost/loaded_file.rb', line 88

def each_file_with_const(const_name, &block)
  if files = self[const_name]
    files.dup.each(&block)
  end
end