Class: String::ASCII
Overview
Constant Summary
collapse
- ASCII =
'ascii'.freeze
- Collation =
'ascii'.freeze
Constants inherited
from String
Binary, COLORS, Encodings, Escapes, UNICODE_LEADERS_AND_TRAILERS, UNICODE_LT_PAT, UNICODE_L_PAT, UNICODE_T_PAT, UNICODE_WHITESPACE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from String
#arguments, #ascii, #binary, #camelcase, #chunks, encodings, #mirc_formatted, #mirc_stripped, #mirc_translated_color, #post_arguments, #strip_user_prefixes, #to_flags, #to_s, #unescaped, #user_prefixes, #utf8, #valid_channelname?, #valid_nickname?, #valid_user?
Class Method Details
.new(string, encoding, collation = nil) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/string/ascii.rb', line 8
def self.new(string, encoding, collation=nil)
unless encoding == String::Binary or encoding == String::ASCII::ASCII then
raise "Encoding must be 'ascii' or 'binary'"
end
unless collation.nil? or collation == Collation then
raise "Collation must be 'ascii' or nil"
end
obj = allocate
obj.send(:initialize, string)
obj
end
|
Instance Method Details
#collation ⇒ Object
24
25
26
|
# File 'lib/string/ascii.rb', line 24
def collation
Collation
end
|
#encoding ⇒ Object
20
21
22
|
# File 'lib/string/ascii.rb', line 20
def encoding
String::ASCII::ASCII
end
|
#inspect ⇒ Object
28
29
30
|
# File 'lib/string/ascii.rb', line 28
def inspect
"#{encoding}(#{collation||'none'}):#{super}"
end
|