Class: ODDB::Import::Whocc::Guidelines::CodeHandler
- Inherits:
-
Object
- Object
- ODDB::Import::Whocc::Guidelines::CodeHandler
- 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
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#visited ⇒ Object
readonly
Returns the value of attribute visited.
Instance Method Summary collapse
-
#initialize ⇒ CodeHandler
constructor
A new instance of CodeHandler.
- #push(code) ⇒ Object
- #shift ⇒ Object
Constructor Details
#initialize ⇒ CodeHandler
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
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
56 57 58 |
# File 'lib/oddb/import/whocc.rb', line 56 def queue @queue end |
#visited ⇒ Object (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 |
#shift ⇒ Object
66 67 68 69 70 |
# File 'lib/oddb/import/whocc.rb', line 66 def shift code = @queue.shift @visited.push(code) code end |