Class: Buhhub::Encoding::LegacyEncoder
- Inherits:
-
Object
- Object
- Buhhub::Encoding::LegacyEncoder
- Defined in:
- lib/bugno/encoding/legacy_encoder.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
- #encode ⇒ Object
-
#initialize(object) ⇒ LegacyEncoder
constructor
A new instance of LegacyEncoder.
Constructor Details
#initialize(object) ⇒ LegacyEncoder
Returns a new instance of LegacyEncoder.
10 11 12 |
# File 'lib/bugno/encoding/legacy_encoder.rb', line 10 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
8 9 10 |
# File 'lib/bugno/encoding/legacy_encoder.rb', line 8 def object @object end |
Instance Method Details
#encode ⇒ Object
14 15 16 17 18 19 |
# File 'lib/bugno/encoding/legacy_encoder.rb', line 14 def encode value = object.to_s encoded_value = ::Iconv.conv('UTF-8//IGNORE', 'UTF-8', value) object.is_a?(Symbol) ? encoded_value.to_sym : encoded_value end |