Module: PunctualDateSelect::DateHash

Defined in:
lib/punctual_date_select/model.rb

Instance Method Summary collapse

Instance Method Details

#dayObject



10
11
12
# File 'lib/punctual_date_select/model.rb', line 10

def day
  get_integer_of :day
end

#monthObject Also known as: mon



6
7
8
# File 'lib/punctual_date_select/model.rb', line 6

def month
  get_integer_of :month
end

#to_dateObject



13
14
15
16
17
18
19
20
21
22
23
# 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) ⇒ Object



24
25
26
27
# File 'lib/punctual_date_select/model.rb', line 24

def to_s(*args)
  date = to_date
  date ? date.to_s(*args) : ""
end

#yearObject



3
4
5
# File 'lib/punctual_date_select/model.rb', line 3

def year
  get_integer_of :year
end