Class: SWT::SimpleCommand
- Inherits:
-
TreeCommand
- Object
- TreeCommand
- SWT::SimpleCommand
- Defined in:
- lib/swt.rb
Instance Method Summary collapse
- #accept(child) ⇒ Object
-
#initialize(parent, child = nil) ⇒ SimpleCommand
constructor
A new instance of SimpleCommand.
- #invoke(tree) ⇒ Object
- #to_s ⇒ Object
Methods inherited from TreeCommand
Constructor Details
#initialize(parent, child = nil) ⇒ SimpleCommand
Returns a new instance of SimpleCommand.
41 42 43 44 |
# File 'lib/swt.rb', line 41 def initialize(parent,child=nil) super(parent) @child=child end |
Instance Method Details
#accept(child) ⇒ Object
45 46 47 |
# File 'lib/swt.rb', line 45 def accept(child) @child=child end |
#invoke(tree) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/swt.rb', line 48 def invoke(tree) @child=@child.call if @child.is_a? Proc raise "Link expression must evaluate to command: #{stacktrace}" unless @child tree=[tree] unless tree.is_a? Array @child.invoke tree end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/swt.rb', line 54 def to_s "#{self.class} (#{@child})" end |