Permalink
Browse files

Reset the description after every method, add arguments to the dsl

  • Loading branch information...
1 parent 3b60f35 commit d34be99a20a2356acdd98c08930a4aa7bc21347e @mtrudel committed Jan 6, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/menutree/leaf.rb
View
@@ -5,19 +5,30 @@ class Leaf
def initialize(parent_tree)
@parent_tree = parent_tree
@commands = {}
- @curent_description = ""
+ reset_dsl
end
def desc(desc)
@current_description = desc
end
+ def arguments(*arguments)
+ @current_arguments += arguments
+ end
+
def singleton_method_added(symbol)
@commands[symbol] = @current_description
+ reset_dsl
end
def leaf(&block)
self.instance_exec(@parent_tree, &block) if block_given?
end
+
+ private
+ def reset_dsl
+ @current_description = ""
+ @current_arguments = []
+ end
end
end

0 comments on commit d34be99

Please sign in to comment.