module PunctualDateSelect::DateHash

Public Instance Methods

day() click to toggle source
# File lib/punctual_date_select/model.rb, line 10
def day
  get_integer_of :day
end
mon()
Alias for: month
month() click to toggle source
# File lib/punctual_date_select/model.rb, line 6
def month
  get_integer_of :month
end
Also aliased as: mon
to_date() click to toggle source
# File lib/punctual_date_select/model.rb, line 13
def to_date
  if year.nil? || month.nil? || day.nil?
    nil
  else
    begin
      Date.new(year, month, day)
    rescue
      nil
    end
  end
end
to_s(*args) click to toggle source
# File lib/punctual_date_select/model.rb, line 24
def to_s(*args)
  date = to_date
  date ? date.to_s(*args) : ""
end
year() click to toggle source
# File lib/punctual_date_select/model.rb, line 3
def year
  get_integer_of :year
end

Private Instance Methods

get_integer_of(key) click to toggle source
# File lib/punctual_date_select/model.rb, line 30
def get_integer_of(key)
  self[key].blank? ? nil : self[key].to_i # This plugin also extends select_year that if this method returns nil it goes well.
end