Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/conversion/object_decoration.rb
Instance Method Summary collapse
-
#convert_entries_to(target, options = {}) ⇒ Object
Converts self to target, with options and enumarable support.
-
#convert_to(target, options = {}) ⇒ Object
Converts self to target, with options.
Instance Method Details
#convert_entries_to(target, options = {}) ⇒ Object
Converts self to target, with options and enumarable support
['1', ['2']].convert_entries_to(Integer)
# => [1, [2]]
'1'.convert_entries_to(Integer)
# => 1
See Conversion.entries_converter for options description
20 21 22 |
# File 'lib/conversion/object_decoration.rb', line 20 def convert_entries_to(target, ={}) Conversion.entries_converter(target, ).call(self) end |
#convert_to(target, options = {}) ⇒ Object
Converts self to target, with options
'1'.convert_to(Integer)
# => 1
See Conversion.converter for options description
8 9 10 |
# File 'lib/conversion/object_decoration.rb', line 8 def convert_to(target, ={}) Conversion.converter(target, ).call(self) end |