Class: Rack::App::Utils::Parser::Float

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/app/utils/parser/float.rb

Instance Method Summary collapse

Instance Method Details

#parse(str) ⇒ Object



2
3
4
# File 'lib/rack/app/utils/parser/float.rb', line 2

def parse(str)
  str.to_f
end

#validate(str) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/rack/app/utils/parser/float.rb', line 6

def validate(str)
  case str.to_s
    when /^\d+\.\d+$/, /^\d+,\d+$/
      return true
    else
      return false
  end
end