Class: DateOrInteger

Inherits:
Object
  • Object
show all
Defined in:
lib/tvrage_api/utility/date_or_integer.rb

Class Method Summary collapse

Class Method Details

.coerce(value) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/tvrage_api/utility/date_or_integer.rb', line 2

def self.coerce(value)
  if value.is_a?(String)
    if value.match('/')
      Date.parse(value)
    else
      value.to_i
    end
  end
end