Class: AsciiCharacteristics
Constant Summary
collapse
- BLANKS =
[
0x9,
0x20,
].freeze
- SEPARATORS =
[
0xA,
0xB,
0xC,
0xD,
].freeze
Characteristics::UNICODE_VERSION, Characteristics::VERSION
Instance Attribute Summary
#encoding
Instance Method Summary
collapse
create, create_for_type, #docomo?, #kddi?, #softbank?, type_from_encoding_name
Constructor Details
Returns a new instance of AsciiCharacteristics.
16
17
18
19
|
# File 'lib/characteristics/ascii.rb', line 16
def initialize(char)
super
@ord = char.ord if @is_valid
end
|
Instance Method Details
#assigned? ⇒ Boolean
29
30
31
|
# File 'lib/characteristics/ascii.rb', line 29
def assigned?
true
end
|
#bidi_control? ⇒ Boolean
61
62
63
|
# File 'lib/characteristics/ascii.rb', line 61
def bidi_control?
false
end
|
#blank? ⇒ Boolean
49
50
51
|
# File 'lib/characteristics/ascii.rb', line 49
def blank?
@is_valid && ( BLANKS.include?(@ord) || SEPARATORS.include?(@ord) )
end
|
#c0? ⇒ Boolean
37
38
39
|
# File 'lib/characteristics/ascii.rb', line 37
def c0?
@is_valid && @ord < 0x20
end
|
#c1? ⇒ Boolean
45
46
47
|
# File 'lib/characteristics/ascii.rb', line 45
def c1?
false
end
|
#control? ⇒ Boolean
33
34
35
|
# File 'lib/characteristics/ascii.rb', line 33
def control?
c0? || delete?
end
|
#delete? ⇒ Boolean
41
42
43
|
# File 'lib/characteristics/ascii.rb', line 41
def delete?
@is_valid && @ord == 0x7F
end
|
57
58
59
|
# File 'lib/characteristics/ascii.rb', line 57
def format?
false
end
|
#separator? ⇒ Boolean
53
54
55
|
# File 'lib/characteristics/ascii.rb', line 53
def separator?
SEPARATORS.include?(@ord)
end
|
#unicode? ⇒ Boolean
25
26
27
|
# File 'lib/characteristics/ascii.rb', line 25
def unicode?
false
end
|
#valid? ⇒ Boolean
21
22
23
|
# File 'lib/characteristics/ascii.rb', line 21
def valid?
@is_valid && !(@encoding_name != "US-ASCII" && @ord >= 0x80)
end
|