Class: GreenPepper::FloatType
- Defined in:
- lib/greenpepper/converter.rb
Class Method Summary collapse
Methods inherited from TypeBase
Class Method Details
.convert ⇒ Object
132 133 134 |
# File 'lib/greenpepper/converter.rb', line 132 def self.convert Proc.new{|s| s.to_f} end |
.format ⇒ Object
136 137 138 139 140 141 142 143 144 |
# File 'lib/greenpepper/converter.rb', line 136 def self.format Proc.new{ |b, expected_format| if expected_format.match /^.[0-9]+$/ b.to_s[1..-1] else b.to_s end } end |
.regex ⇒ Object
128 129 130 |
# File 'lib/greenpepper/converter.rb', line 128 def self.regex /^\s*-?[0-9]*\.[0-9]+\s*$/ end |