Class: SWT::ChildrenCommand
- Inherits:
-
ContainerTreeCommand
- Object
- TreeCommand
- ContainerTreeCommand
- SWT::ChildrenCommand
- Defined in:
- lib/swt.rb
Instance Method Summary collapse
- #accept(cmd) ⇒ Object
-
#initialize(parent, exp) ⇒ ChildrenCommand
constructor
A new instance of ChildrenCommand.
- #invoke(stack) ⇒ Object
Methods inherited from ContainerTreeCommand
Methods inherited from TreeCommand
Constructor Details
#initialize(parent, exp) ⇒ ChildrenCommand
Returns a new instance of ChildrenCommand.
180 181 182 183 184 |
# File 'lib/swt.rb', line 180 def initialize(parent,exp) super(parent) @exp=exp @inner=ContainerTreeCommand.new self end |
Instance Method Details
#accept(cmd) ⇒ Object
177 178 179 |
# File 'lib/swt.rb', line 177 def accept(cmd) @inner.accept cmd end |
#invoke(stack) ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/swt.rb', line 185 def invoke(stack) last=stack.last.getData("object") coll=@exp.call(last) coll.each do |x| cmd=ChildCommand.new self @children << cmd cmd.accept(ObjectCommand.new(self,lambda{last})) cmd.accept(ObjectCommand.new(self,lambda{x})) cmd.accept(@inner) cmd.invoke stack end end |