Class: Markaby::Builder
- Inherits:
-
Object
- Object
- Markaby::Builder
- Defined in:
- lib/cuca/generator/markaby.rb
Overview
Modify Markaby’s method_missing function so we find our own widgets
Instance Method Summary collapse
-
#method_missing(sym, *args, &block) ⇒ Object
:nodoc:.
-
#old_method_missing ⇒ Object
:nodoc:.
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 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cuca/generator/markaby.rb', line 8 def method_missing(sym, *args, &block ) # :nodoc: class_name = sym.id2name return old_method_missing(sym, *args, &block) if (class_name[0].chr.upcase != class_name[0].chr) if Object.const_defined?(class_name+'Widget') then c = Object::const_get(class_name+"Widget") else # try to find the widget in the action namespace return old_method_missing(sym, *args,&block) if $app.nil? am = $app.urlmap.action_module if am.const_defined?(class_name+'Widget') then c = am.const_get(class_name+'Widget') else return old_method_missing(sym, *args, &block) end end # $stderr.puts "Widget in markaby: Class: #{class_name}, \n\n assigns: #{@assigns.inspect} \n\n" = c.new({:args => args, :assigns => @assigns }, &block) # $stderr.puts "Widget:" + widget.inspect @builder << .to_s # $stderr.puts "Good" end |
Instance Method Details
#old_method_missing ⇒ Object
:nodoc:
6 |
# File 'lib/cuca/generator/markaby.rb', line 6 alias :old_method_missing :method_missing |