Class: Stick::Units::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/stick/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/stick/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/stick/units/loaders.rb', line 19

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