Kiss A simpler, smarter web application framework for Ruby

Kiss::Format::MonthYear Subclass of Kiss::Format::Date

Methods

Public Class Methods

parse(value) source

Not documented

    # File lib/kiss/format.rb, line 159
        def parse(value)
          month, year = value.sub(/\A\s*/,'').sub(/\s*\Z/,'').split(/\D+/)
          # convert two-digit years to four-digit years
          year = year.to_i
          if year < 100
            year += 1900
            year += 100 if year < ::Time.now.year - 95
          end
          begin
            ::Time.parse("#{month}/#{year}")
          rescue ArgumentError => e
            raise Kiss::Format::ValidateError, e.message
          end
        end
    
value_to_s(value) source

Not documented

    # File lib/kiss/format.rb, line 174
        def value_to_s(value)
          value.strftime("%m/%Y")
        end
    

Disabled; run with $DEBUG to generate this.