Class: Makers::Definitions

Inherits:
Object
  • Object
show all
Defined in:
lib/makers/definitions.rb

Instance Method Summary collapse

Instance Method Details

#add(ids, *args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/makers/definitions.rb', line 12

def add(ids, *args)
  maker = Maker.new(*args)
  ids.each do |id|
    if registry.has_key?(id)
      raise "Maker #{id} already registered"
    else
      registry[id] = maker
    end
  end
end

#find(id) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/makers/definitions.rb', line 4

def find(id)
  if registry.has_key?(id)
    registry[id]
  else
    raise "Definition #{id} not found"
  end
end