Class: SWT::LabelCommand

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

Instance Method Summary collapse

Methods inherited from TreeCommand

#accept, #stacktrace

Constructor Details

#initialize(parent, exp, index = 0) ⇒ LabelCommand

Returns a new instance of LabelCommand


139
140
141
142
143
# File 'lib/swt.rb', line 139

def initialize(parent,exp,index=0)
  super(parent)
  @exp=exp
  @index=index
end

Instance Method Details

#invoke(stack) ⇒ Object


144
145
146
# File 'lib/swt.rb', line 144

def invoke(stack)
  stack.last.setText(@index,@exp.call(stack.last.getData("object")).to_s)
end

#to_sObject


147
148
149
# File 'lib/swt.rb', line 147

def to_s
  "LabelCmd (#{@exp})"
end