Module: Ruote

Defined in:
lib/ruote-registry.rb

Class Method Summary collapse

Class Method Details

.define(*attributes, &block) ⇒ Object

Override the default Ruote.define and store the created pdef in a registry which can be read through Ruote.definition



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruote-registry.rb', line 8

def define(*attributes, &block)

  pdef = RubyDsl.create_branch('define', attributes, &block) 
  
  if (name = pdef[1]['name'])
    @pdef_registry ||= {}
    @pdef_registry[name.to_sym] = pdef
  end
  
  return pdef
end

.definition(name) ⇒ Object

Return a stored pdef

Parameters:

  • name (String, Symbol)

    The :name of the definition



24
25
26
# File 'lib/ruote-registry.rb', line 24

def definition(name)
  @pdef_registry[name.to_sym]
end