Class: ODDB::Import::Whocc::Guidelines::CodeHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/oddb/import/whocc.rb

Constant Summary collapse

ATC_TOP_LEVEL =
%w{A B C D G H J L M N P R S V}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCodeHandler

Returns a new instance of CodeHandler.



57
58
59
60
# File 'lib/oddb/import/whocc.rb', line 57

def initialize
  @queue = ATC_TOP_LEVEL.dup
  @visited = []
end

Instance Attribute Details

#queueObject (readonly)

Returns the value of attribute queue.



56
57
58
# File 'lib/oddb/import/whocc.rb', line 56

def queue
  @queue
end

#visitedObject (readonly)

Returns the value of attribute visited.



56
57
58
# File 'lib/oddb/import/whocc.rb', line 56

def visited
  @visited
end

Instance Method Details

#push(code) ⇒ Object



61
62
63
64
65
# File 'lib/oddb/import/whocc.rb', line 61

def push(code)
  unless((@queue + @visited).include?(code))
    @queue.push(code)
  end
end

#shiftObject



66
67
68
69
70
# File 'lib/oddb/import/whocc.rb', line 66

def shift
  code = @queue.shift
  @visited.push(code)
  code
end