Class: ProgramR::ReadOnlyTag

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

Constant Summary collapse

@@environment =
Environment.new

Instance Method Summary collapse

Constructor Details

#initialize(aLocalname, someAttributes) ⇒ ReadOnlyTag

Returns a new instance of ReadOnlyTag.



204
205
206
207
208
209
210
211
# File 'lib/programr/aiml_elements.rb', line 204

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

Instance Method Details

#executeObject Also known as: to_s



213
214
215
216
# File 'lib/programr/aiml_elements.rb', line 213

def execute
  return @@environment.get(@localname) if(@attributed.empty?)
  @@environment.get(@attributed['name']) 
end

#inspectObject



218
219
220
# File 'lib/programr/aiml_elements.rb', line 218

def inspect() 
  return "roTag #{@localname} -> #{execute}" 
end