Class: TSparser::AribStringDecoder::Definition::CodeCaller
- Inherits:
-
Object
- Object
- TSparser::AribStringDecoder::Definition::CodeCaller
- Defined in:
- lib/arib_string_decoder.rb
Instance Method Summary collapse
- #candidates(seq) ⇒ Object
-
#initialize ⇒ CodeCaller
constructor
A new instance of CodeCaller.
- #pull(seq) ⇒ Object
- #set(name, seq, group, target_region, call_type) ⇒ Object
Constructor Details
#initialize ⇒ CodeCaller
Returns a new instance of CodeCaller.
93 94 95 96 |
# File 'lib/arib_string_decoder.rb', line 93 def initialize @map_whole = Hash.new @map_part = Hash.new{0} end |
Instance Method Details
#candidates(seq) ⇒ Object
106 107 108 |
# File 'lib/arib_string_decoder.rb', line 106 def candidates(seq) return @map_part[seq] end |
#pull(seq) ⇒ Object
110 111 112 113 114 115 |
# File 'lib/arib_string_decoder.rb', line 110 def pull(seq) unless res = @map_whole[seq] raise "No call match with #{seq}." end return res end |
#set(name, seq, group, target_region, call_type) ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/arib_string_decoder.rb', line 98 def set(name, seq, group, target_region, call_type) seq = seq.map{|int| Binary.from_int(int)} @map_whole[seq] = [group, target_region, call_type] seq.length.times do |i| @map_part[seq[0..i]] += 1 end end |