Class: RuleMap
Instance Attribute Summary collapse
-
#hash_map ⇒ Object
Returns the value of attribute hash_map.
-
#var ⇒ Object
Returns the value of attribute var.
Instance Method Summary collapse
- #fetch(object) ⇒ Object
-
#initialize ⇒ RuleMap
constructor
A new instance of RuleMap.
Constructor Details
#initialize ⇒ RuleMap
Returns a new instance of RuleMap.
4 5 6 7 |
# File 'lib/Rule/rule_map.rb', line 4 def initialize self.hash_map = {} self.var = 'a' end |
Instance Attribute Details
#hash_map ⇒ Object
Returns the value of attribute hash_map.
2 3 4 |
# File 'lib/Rule/rule_map.rb', line 2 def hash_map @hash_map end |
#var ⇒ Object
Returns the value of attribute var.
2 3 4 |
# File 'lib/Rule/rule_map.rb', line 2 def var @var end |
Instance Method Details
#fetch(object) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/Rule/rule_map.rb', line 9 def fetch(object) unless hash_map.key?(object) hash_map[object] = var.to_s self.var = var.next end hash_map[object] end |