Class: SWT::ChildrenCommand

Inherits:
ContainerTreeCommand show all
Defined in:
lib/swt.rb

Instance Method Summary collapse

Methods inherited from ContainerTreeCommand

#to_s

Methods inherited from TreeCommand

#stacktrace

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