Class: Makers::Traits

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

Instance Method Summary collapse

Instance Method Details

#add(id, block) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/makers/traits.rb', line 12

def add(id, block)
  if registry.has_key?(id)
    raise "Trait #{id} already registered"
  else
    registry[id] = block
  end
end

#find(id) ⇒ Object



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

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