Class: ProgramR::GetTag

Inherits:
AimlTag show all
Defined in:
lib/programr/aiml_elements.rb

Instance Method Summary collapse

Methods inherited from AimlTag

#inspect, #to_s

Constructor Details

#initialize(aLocalname, someAttributes, environment) ⇒ GetTag

Returns a new instance of GetTag.


311
312
313
314
315
316
317
318
319
# File 'lib/programr/aiml_elements.rb', line 311

def initialize aLocalname, someAttributes, environment
  @environment = environment
  @localname = aLocalname.sub(/^get_/, '')
  if someAttributes.has_key?('index') && @localname == 'that'
    @localname = 'justbeforethat' if someAttributes['index'] == '2,1'
    someAttributes = {}
  end
  @attributed = someAttributes
end

Instance Method Details

#executeObject


321
322
323
# File 'lib/programr/aiml_elements.rb', line 321

def execute
  to_response @environment.get(@attributed['name'] || @localname)
end