Class: Characteristics
- Inherits:
-
Object
show all
- Defined in:
- lib/characteristics.rb,
lib/characteristics/version.rb
Constant Summary
collapse
- VERSION =
"1.7.1"
- UNICODE_VERSION =
"16.0.0"
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Characteristics.
45
46
47
48
49
50
51
|
# File 'lib/characteristics.rb', line 45
def initialize(char)
raise ArgumentError, "Do not use abstract Characteristics.new(char) directly, please use Characteristics.create(char)" if self.class == Characteristics
@is_valid = char.valid_encoding?
@encoding = char.encoding
@encoding_name = @encoding.name
end
|
Instance Attribute Details
#encoding ⇒ Object
Returns the value of attribute encoding.
43
44
45
|
# File 'lib/characteristics.rb', line 43
def encoding
@encoding
end
|
Class Method Details
.create(char) ⇒ Object
39
40
41
|
# File 'lib/characteristics.rb', line 39
def self.create(char)
create_for_type(char, type_from_encoding_name(char.encoding.name))
end
|
.create_for_type(char, type) ⇒ Object
.type_from_encoding_name(encoding_name) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/characteristics.rb', line 11
def self.type_from_encoding_name(encoding_name)
case encoding_name
when "US-ASCII", "GB1988"
:ascii
when "ASCII-8BIT"
:binary
when /^UTF-?/
:unicode
when /^ISO-8859-/, /^Windows-125/, /^(IBM|CP85)/, /^mac/, 'TIS-620', 'Windows-874', /^KOI8-/
:byte
else
raise ArgumentError, "encoding <#{encoding_name}> not supported"
end
end
|
Instance Method Details
#assigned? ⇒ Boolean
60
61
|
# File 'lib/characteristics.rb', line 60
def assigned?
end
|
#bidi_control? ⇒ Boolean
81
82
|
# File 'lib/characteristics.rb', line 81
def bidi_control?
end
|
#blank? ⇒ Boolean
75
76
|
# File 'lib/characteristics.rb', line 75
def blank?
end
|
#c0? ⇒ Boolean
66
67
|
# File 'lib/characteristics.rb', line 66
def c0?
end
|
#c1? ⇒ Boolean
72
73
|
# File 'lib/characteristics.rb', line 72
def c1?
end
|
#control? ⇒ Boolean
63
64
|
# File 'lib/characteristics.rb', line 63
def control?
end
|
#delete? ⇒ Boolean
69
70
|
# File 'lib/characteristics.rb', line 69
def delete?
end
|
#docomo? ⇒ Boolean
93
94
|
# File 'lib/characteristics.rb', line 93
def docomo?
end
|
78
79
|
# File 'lib/characteristics.rb', line 78
def format?
end
|
#kddi? ⇒ Boolean
85
86
|
# File 'lib/characteristics.rb', line 85
def kddi?
end
|
#softbank? ⇒ Boolean
89
90
|
# File 'lib/characteristics.rb', line 89
def softbank?
end
|
#unicode? ⇒ Boolean
57
58
|
# File 'lib/characteristics.rb', line 57
def unicode?
end
|
#valid? ⇒ Boolean
53
54
55
|
# File 'lib/characteristics.rb', line 53
def valid?
@is_valid
end
|