Class: Markaby::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/cuca/generator/markaby.rb

Overview

Modify Markaby’s method_missing function so we find our own widgets

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object

:nodoc:



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cuca/generator/markaby.rb', line 8

def method_missing(sym, *args, &block )	# :nodoc:
  class_name = sym.id2name  
  begin
    c=Object::const_get(class_name+"Widget")
  rescue NameError => e
    return old_method_missing(sym,*args,&block)
  end

#    $stderr.puts "Widget in markaby: Class: #{class_name}, \n\n assigns: #{@assigns.inspect} \n\n"

  widget = c.new({:args => args,
                  :assigns => @assigns },
                  &block)

 #   $stderr.puts "Widget:" + widget.inspect
  @builder <<  widget.to_s

#    $stderr.puts "Good"
end

Instance Method Details

#old_method_missingObject

:nodoc:



6
# File 'lib/cuca/generator/markaby.rb', line 6

alias :old_method_missing :method_missing