Class: ParameterSubstitution::Formatters::ToF
- Inherits:
-
Base
- Object
- Base
- ParameterSubstitution::Formatters::ToF
show all
- Defined in:
- lib/parameter_substitution/formatters/to_f.rb
Class Method Summary
collapse
Methods inherited from Base
encoding, has_parameters?, key, parse_duration
Class Method Details
.description ⇒ Object
4
5
6
|
# File 'lib/parameter_substitution/formatters/to_f.rb', line 4
def self.description
"Converts a string to a double-precision floating point number"
end
|
8
9
10
|
# File 'lib/parameter_substitution/formatters/to_f.rb', line 8
def self.format(value)
Float(value).round(2) rescue nil
end
|