Class: SerializableAttributes::String
- Inherits:
-
AttributeType
- Object
- AttributeType
- SerializableAttributes::String
- Defined in:
- lib/serializable_attributes/types.rb
Instance Method Summary collapse
-
#parse(str) ⇒ Object
converts unicode (u003c) to the actual character rishida.net/tools/conversion/.
Methods inherited from AttributeType
#default, #encode, #initialize, #type_for
Constructor Details
This class inherits a constructor from SerializableAttributes::AttributeType
Instance Method Details
#parse(str) ⇒ Object
converts unicode (u003c) to the actual character rishida.net/tools/conversion/
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/serializable_attributes/types.rb', line 48 def parse(str) return nil if str.nil? str.to_s.gsub(/\\u([0-9a-fA-F]{4})/) do |s| int = $1.to_i(16) if int.zero? && s != "0000" s else [int].pack("U") end end end |