Class: Crumbs::Definitions

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

Instance Method Summary collapse

Instance Method Details

#add(id, name) ⇒ Object



15
16
17
# File 'lib/crumbs/definitions.rb', line 15

def add(id, name)
  registry[id] = name
end

#find(id, params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/crumbs/definitions.rb', line 4

def find(id, params)
  if registry.has_key?(id)
    name = registry[id]
    if name.is_a?(Proc)
      name.call params
    else
      name
    end
  end
end