Class: ProgramR::ListCondition

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

Instance Method Summary collapse

Methods inherited from Condition

#add, #inspect, #setListElement

Constructor Details

#initialize(someAttributes) ⇒ ListCondition

Returns a new instance of ListCondition.



121
122
123
124
# File 'lib/programr/aiml_elements.rb', line 121

def initialize(someAttributes)
  @conditions = {}
  @property = someAttributes['name'] if(someAttributes.key?('name'))
end

Instance Method Details

#executeObject Also known as: to_s



126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/programr/aiml_elements.rb', line 126

def execute
  @conditions.keys.each do |key|
    if(@@environment.get(@property) == key)
      res = ''
      @conditions[key].each{|tocken|
      res += tocken.to_s
    }
    return res.strip
    end
  end
  return ''
end