Class: Rack::App::Utils::Parser::Integer

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

Instance Method Summary collapse

Instance Method Details

#parse(str) ⇒ Object



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

def parse(str)
  str.to_s.to_i
end

#validate(str) ⇒ Object



6
7
8
# File 'lib/rack/app/utils/parser/integer.rb', line 6

def validate(str)
  !!(str =~ /^\d+$/)
end