Class: TSparser::AribStringDecoder::Decoder::CodeOutputer
- Inherits:
-
Object
- Object
- TSparser::AribStringDecoder::Decoder::CodeOutputer
- Defined in:
- lib/arib_string_decoder.rb
Overview
Inner class to output string code(bytes).
Instance Method Summary collapse
- #assign(code_name, *args) ⇒ Object
-
#initialize(code_proc_map, decoded) ⇒ CodeOutputer
constructor
A new instance of CodeOutputer.
- #output(code_name, *args) ⇒ Object
- #output_ascii_code(byte_integer) ⇒ Object
- #output_jis_ascii(byte) ⇒ Object
- #output_jis_hankaku(byte) ⇒ Object
- #output_jis_zenkaku(byte1, byte2) ⇒ Object
- #output_str(string) ⇒ Object
Constructor Details
#initialize(code_proc_map, decoded) ⇒ CodeOutputer
Returns a new instance of CodeOutputer.
343 344 345 346 |
# File 'lib/arib_string_decoder.rb', line 343 def initialize(code_proc_map, decoded) @code_proc_map = code_proc_map @decoded = decoded end |
Instance Method Details
#assign(code_name, *args) ⇒ Object
359 360 361 |
# File 'lib/arib_string_decoder.rb', line 359 def assign(code_name, *args) output(code_name, *args) end |
#output(code_name, *args) ⇒ Object
348 349 350 351 352 353 |
# File 'lib/arib_string_decoder.rb', line 348 def output(code_name, *args) unless @code_proc_map[code_name] raise "Undefined code \"#{code_name}\" is called." end instance_exec(*args, &@code_proc_map[code_name]) end |
#output_ascii_code(byte_integer) ⇒ Object
355 356 357 |
# File 'lib/arib_string_decoder.rb', line 355 def output_ascii_code(byte_integer) @decoded.push_jis_ascii(Binary.from_int(byte_integer)) end |
#output_jis_ascii(byte) ⇒ Object
367 368 369 |
# File 'lib/arib_string_decoder.rb', line 367 def output_jis_ascii(byte) @decoded.push_jis_ascii(byte) end |
#output_jis_hankaku(byte) ⇒ Object
371 372 373 |
# File 'lib/arib_string_decoder.rb', line 371 def output_jis_hankaku(byte) @decoded.push_jis_hankaku(byte) end |
#output_jis_zenkaku(byte1, byte2) ⇒ Object
375 376 377 |
# File 'lib/arib_string_decoder.rb', line 375 def output_jis_zenkaku(byte1, byte2) @decoded.push_jis_zenkaku(byte1, byte2) end |
#output_str(string) ⇒ Object
363 364 365 |
# File 'lib/arib_string_decoder.rb', line 363 def output_str(string) @decoded.push_str(string) end |