Class: Kortype::Parse
- Inherits:
-
Object
- Object
- Kortype::Parse
- Defined in:
- lib/kortype/parse.rb
Constant Summary collapse
- PARSE =
{ String => :to_s, Integer => :to_i, Fixnum => :to_i, Float => :to_f, Array => :to_a, Hash => :to_h, #BigDecimal => :to_d, Symbol => :to_sym }
Class Method Summary collapse
Class Method Details
.has_parse?(type) ⇒ Boolean
13 14 15 |
# File 'lib/kortype/parse.rb', line 13 def self.has_parse? type PARSE.has_key? type end |
.parse(value, type) ⇒ Object
16 17 18 |
# File 'lib/kortype/parse.rb', line 16 def self.parse(value, type) value.send(PARSE[type]) end |