Class: Van::Units::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/van/units/loaders.rb

Class Method Summary collapse

Class Method Details

.handles(*types) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/van/units/loaders.rb', line 8

def handles(*types)
  handles = @handles ||= []
  unless types.empty?
    res = handles.push(*types)
    Converter.register_loader(self)
    res
  else
    handles
  end
end

.method_added(m) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/van/units/loaders.rb', line 19

def method_added(m)
  eval %{
    def self.#{m}(*a, &b)
      (@instance ||= new).#{m}(*a, &b)
    end
  }
  super
end