Module: Coder::Cleaner::Simple::Encodings::UCS_2BE
- Extended by:
- UCS_2BE
- Defined in:
- lib/coder/cleaner/simple/encodings.rb
Instance Method Summary collapse
- #codepoint(values) ⇒ Object
- #garbage?(input, buffered) ⇒ Boolean
- #multibyte?(input, buffered) ⇒ Boolean
- #multibyte_body?(input, buffered) ⇒ Boolean
- #multibyte_size ⇒ Object
- #multibyte_start?(input, buffered) ⇒ Boolean
- #single_byte?(input, buffered) ⇒ Boolean
Instance Method Details
#codepoint(values) ⇒ Object
75 76 77 |
# File 'lib/coder/cleaner/simple/encodings.rb', line 75 def codepoint(values) values.inject { |a,b| (a << 8) + b } end |
#garbage?(input, buffered) ⇒ Boolean
49 50 51 52 53 |
# File 'lib/coder/cleaner/simple/encodings.rb', line 49 def garbage?(input, buffered) return false unless buffered.size + 1 == multibyte_size return true if codepoint(buffered + [input]) > 0x10FFFF input == 0 and buffered.all? { |b| b == 0 } end |
#multibyte?(input, buffered) ⇒ Boolean
59 60 61 |
# File 'lib/coder/cleaner/simple/encodings.rb', line 59 def multibyte?(input, buffered) true end |
#multibyte_body?(input, buffered) ⇒ Boolean
67 68 69 |
# File 'lib/coder/cleaner/simple/encodings.rb', line 67 def multibyte_body?(input, buffered) not multibyte_start? input, buffered end |
#multibyte_size ⇒ Object
71 72 73 |
# File 'lib/coder/cleaner/simple/encodings.rb', line 71 def multibyte_size(*) 2 end |
#multibyte_start?(input, buffered) ⇒ Boolean
63 64 65 |
# File 'lib/coder/cleaner/simple/encodings.rb', line 63 def multibyte_start?(input, buffered) buffered.size % multibyte_size == 0 end |
#single_byte?(input, buffered) ⇒ Boolean
55 56 57 |
# File 'lib/coder/cleaner/simple/encodings.rb', line 55 def single_byte?(input, buffered) false end |