Class: UTF8Cleaner::URIString
- Inherits:
-
Object
- Object
- UTF8Cleaner::URIString
- Defined in:
- lib/utf8-cleaner/uri_string.rb
Overview
Cleans invalid %-encodings from URI-encoded strings.
Constant Summary collapse
- HEX_CHARS =
'0-9a-fA-F'
- HEX_CHARS_REGEX =
/[#{HEX_CHARS}]/
- INVALID_PERCENT_ENCODING_REGEX =
/%(?![#{HEX_CHARS}]{2})/
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #cleaned ⇒ Object
-
#initialize(data) ⇒ URIString
constructor
A new instance of URIString.
- #valid? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ URIString
Returns a new instance of URIString.
10 11 12 |
# File 'lib/utf8-cleaner/uri_string.rb', line 10 def initialize(data) self.data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/utf8-cleaner/uri_string.rb', line 4 def data @data end |
Instance Method Details
#cleaned ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/utf8-cleaner/uri_string.rb', line 14 def cleaned if valid? data else encoded_char_array.join end end |
#valid? ⇒ Boolean
22 23 24 |
# File 'lib/utf8-cleaner/uri_string.rb', line 22 def valid? valid_uri_encoded_utf8(data) end |