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



48
49
50
# File 'lib/rails_development_boost/loaded_file.rb', line 48

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

#deassociate(const_name, file) ⇒ Object



52
53
54
55
56
57
# File 'lib/rails_development_boost/loaded_file.rb', line 52

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



59
60
61
62
63
# File 'lib/rails_development_boost/loaded_file.rb', line 59

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