Class: Autumn::TemplateCoder
Overview
Generates Autumn-specific code templates like leaves and filters.
Instance Attribute Summary
Attributes inherited from Coder
Instance Method Summary collapse
-
#leaf(name) ⇒ Object
Generates an Leaf subclass with the given name.
Methods inherited from Coder
#<<, #doc=, #indent!, #initialize, #klass, #method, #newline!, #unindent!
Constructor Details
This class inherits a constructor from Autumn::Coder
Instance Method Details
#leaf(name) ⇒ Object
Generates an Leaf subclass with the given name.
153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/autumn/coder.rb', line 153 def leaf(name) controller = klass('Controller', 'Autumn::Leaf') do |leaf| leaf.newline! leaf << '# Typing "!about" displays some basic information about this leaf.' leaf.newline! about_command = leaf.method('about_command', 'stem', 'sender', 'reply_to', 'msg') do |about| about << '# This method renders the file "about.txt.erb"' end end controller.doc = "Controller for the #{name.camelcase} leaf." return controller end |