Class: BinaryCharacteristics

Inherits:
Characteristics show all
Defined in:
lib/characteristics/binary.rb

Constant Summary collapse

BLANKS =
[
  0x9,
  0x20,
].freeze
SEPARATORS =
[
  0xA,
  0xB,
  0xC,
  0xD,
].freeze

Constants inherited from Characteristics

Characteristics::UNICODE_VERSION, Characteristics::VERSION

Instance Attribute Summary

Attributes inherited from Characteristics

#encoding

Instance Method Summary collapse

Methods inherited from Characteristics

create, create_for_type, #docomo?, #kddi?, #softbank?, type_from_encoding_name

Constructor Details

#initialize(char) ⇒ BinaryCharacteristics

Returns a new instance of BinaryCharacteristics.



16
17
18
19
20
# File 'lib/characteristics/binary.rb', line 16

def initialize(char)
  @ord = char.ord
  @encoding = char.encoding
  @encoding_name = @encoding.name
end

Instance Method Details

#assigned?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/characteristics/binary.rb', line 30

def assigned?
  true
end

#bidi_control?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/characteristics/binary.rb', line 62

def bidi_control?
  false
end

#blank?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/characteristics/binary.rb', line 50

def blank?
  BLANKS.include?(@ord) || SEPARATORS.include?(@ord)
end

#c0?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/characteristics/binary.rb', line 38

def c0?
  @ord < 0x20
end

#c1?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/characteristics/binary.rb', line 46

def c1?
  false
end

#control?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/characteristics/binary.rb', line 34

def control?
  c0? || delete?
end

#delete?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/characteristics/binary.rb', line 42

def delete?
  @ord == 0x7F
end

#format?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/characteristics/binary.rb', line 58

def format?
  false
end

#separator?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/characteristics/binary.rb', line 54

def separator?
  SEPARATORS.include?(@ord)
end

#unicode?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/characteristics/binary.rb', line 26

def unicode?
  false
end

#valid?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/characteristics/binary.rb', line 22

def valid?
  true
end