Module: Stupidedi::Reader
- Defined in:
- lib/stupidedi/reader.rb,
lib/stupidedi/reader/input.rb,
lib/stupidedi/reader/result.rb,
lib/stupidedi/reader/position.rb,
lib/stupidedi/reader/separators.rb,
lib/stupidedi/reader/segment_dict.rb,
lib/stupidedi/reader/token_reader.rb,
lib/stupidedi/reader/stream_reader.rb,
lib/stupidedi/reader/input/file_input.rb,
lib/stupidedi/reader/tokens/segment_tok.rb,
lib/stupidedi/reader/input/abstract_input.rb,
lib/stupidedi/reader/input/delegated_input.rb,
lib/stupidedi/reader/tokens/simple_element_tok.rb,
lib/stupidedi/reader/tokens/repeated_element_tok.rb,
lib/stupidedi/reader/tokens/component_element_tok.rb,
lib/stupidedi/reader/tokens/composite_element_tok.rb
Defined Under Namespace
Modules: Input, Result
Classes: AbstractInput, ComponentElementTok, CompositeElementTok, DelegatedInput, Failure, FileInput, Position, RepeatedElementTok, SegmentDict, SegmentTok, Separators, SimpleElementTok, StreamReader, Success, TokenReader
Constant Summary
collapse
- R_BASIC =
/[A-Z0-9!"&'()*+,.\/:;?= -]/.freeze
- R_EXTENDED =
/[a-z%@\[\]_{}\\|<>~^`#\$ÀÁÂÄàáâäÈÉÊèéêëÌÍÎìíîïÒÓÔÖòóôöÙÚÛÜùúûüÇçÑñ¿¡]/.freeze
- R_EITHER =
Regexp.union(R_BASIC, R_EXTENDED).freeze
- C_BYTES =
(0..255).inject(""){|string, c| string + [c].pack('U') }
- H_BASIC =
C_BYTES.scan(R_BASIC).inject({}){|h,c| h[c] = nil; h }.freeze
- H_EXTENDED =
C_BYTES.scan(R_EXTENDED).inject({}){|h,c| h[c] = nil; h }.freeze
- H_EITHER =
C_BYTES.scan(R_EITHER).inject({}){|h,c| h[c] = nil; h }.freeze
Class Method Summary
collapse
Class Method Details
.basic_characters ⇒ Character
105
106
107
|
# File 'lib/stupidedi/reader.rb', line 105
def basic_characters
H_BASIC.keys
end
|
.control_characters ⇒ Character
117
118
119
|
# File 'lib/stupidedi/reader.rb', line 117
def control_characters
C_BYTES.split(//) - H_EITHER.keys
end
|
.extended_characters ⇒ Character
111
112
113
|
# File 'lib/stupidedi/reader.rb', line 111
def extended_characters
H_EXTENDED.keys
end
|
.has_control_characters?(string) ⇒ Boolean
99
100
101
|
# File 'lib/stupidedi/reader.rb', line 99
def has_control_characters?(string)
end
|
.has_extended_characters?(string) ⇒ Boolean
94
95
96
|
# File 'lib/stupidedi/reader.rb', line 94
def has_extended_characters?(string)
R_EXTENDED =~ string
end
|
.is_basic_character?(character) ⇒ Boolean
83
84
85
|
# File 'lib/stupidedi/reader.rb', line 83
def is_basic_character?(character)
H_BASIC.include?(character)
end
|
.is_control_character?(character) ⇒ Boolean
Returns true if ‘character` does not belong to the extended or basic character set.
77
78
79
|
# File 'lib/stupidedi/reader.rb', line 77
def is_control_character?(character)
not H_EITHER.include?(character)
end
|
.is_extended_character?(character) ⇒ Boolean
89
90
91
|
# File 'lib/stupidedi/reader.rb', line 89
def is_extended_character?(character)
H_EXTENDED.include?(character)
end
|