Module: Mittsu::Loader::Handlers

Defined in:
lib/mittsu/loaders/loader.rb

Class Method Summary collapse

Class Method Details

.add(regex, loader) ⇒ Object



140
141
142
143
# File 'lib/mittsu/loaders/loader.rb', line 140

def self.add(regex, loader)
  @@handlers ||= {}
  @@handlers[regex] = loader
end

.get(file) ⇒ Object



145
146
147
148
# File 'lib/mittsu/loaders/loader.rb', line 145

def self.get(file)
  @@handlers ||= {}
  @@handlers.find(-> () { [nil, nil] }) { |regex, loader| regex =~ file }[1]
end