Class: DashcodeConverter::Controller
- Inherits:
-
Object
- Object
- DashcodeConverter::Controller
- Defined in:
- lib/dashcode-converter/controller.rb
Constant Summary collapse
- DECL_TEMPLATE =
" /*import coherent*/\n\n <%=namespace%>.<%=name%>= Class.create(coherent.ViewController, {\n \n <%[email protected](\",\\n\").indent(INDENT)%>\n \n });\n"
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #add_action_method(name) ⇒ Object
- #declaration ⇒ Object
-
#initialize(name, namespace = nil) ⇒ Controller
constructor
A new instance of Controller.
Constructor Details
#initialize(name, namespace = nil) ⇒ Controller
Returns a new instance of Controller.
17 18 19 20 21 |
# File 'lib/dashcode-converter/controller.rb', line 17 def initialize(name, namespace=nil) @name= "#{name.capitalize}Controller" @namespace= namespace || name @methods= [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/dashcode-converter/controller.rb', line 15 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
15 16 17 |
# File 'lib/dashcode-converter/controller.rb', line 15 def namespace @namespace end |
Instance Method Details
#add_action_method(name) ⇒ Object
23 24 25 |
# File 'lib/dashcode-converter/controller.rb', line 23 def add_action_method(name) @methods << "#{name}: function(sender)\n{\n}" end |
#declaration ⇒ Object
27 28 29 30 |
# File 'lib/dashcode-converter/controller.rb', line 27 def declaration return @declaration if @declaration @declaration= ERB.new(DECL_TEMPLATE.remove_indent).result binding end |