Class: RuleMap

Inherits:
Object show all
Defined in:
lib/Rule/rule_map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRuleMap

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_mapObject

Returns the value of attribute hash_map.



2
3
4
# File 'lib/Rule/rule_map.rb', line 2

def hash_map
  @hash_map
end

#varObject

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