class Rasti::Types::Float

Constants

FORMAT

Private Class Methods

transform(value) click to toggle source
# File lib/rasti/types/float.rb, line 16
def transform(value)
  value.to_f
end
transformable?(value) click to toggle source
# File lib/rasti/types/float.rb, line 24
def transformable?(value)
  !value.is_a?(::String) && value.respond_to?(:to_f)
end
valid?(value) click to toggle source
# File lib/rasti/types/float.rb, line 12
def valid?(value)
  valid_string?(value) || transformable?(value)
end
valid_string?(value) click to toggle source
# File lib/rasti/types/float.rb, line 20
def valid_string?(value)
  value.is_a?(::String) && value.match(FORMAT)
end