Class: ParsableHash::Converters::Base
- Inherits:
-
Object
- Object
- ParsableHash::Converters::Base
- Defined in:
- lib/parsable_hash/converters/base.rb
Instance Method Summary collapse
- #call(&block) ⇒ Object
-
#initialize(value) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(value) ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/parsable_hash/converters/base.rb', line 4 def initialize(value) @value = value end |
Instance Method Details
#call(&block) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/parsable_hash/converters/base.rb', line 8 def call(&block) try_convert rescue => e if block_given? block.call(@value) else @value end end |