Module: Starburstpisa

Defined in:
lib/starburstpisa.rb

Instance Method Summary collapse

Instance Method Details

#first_day_of_the_month(year, month) ⇒ Object



20
21
22
# File 'lib/starburstpisa.rb', line 20

def first_day_of_the_month(year, month)
  Date.new(year, month)
end

#is_valid_date?(year, month, day) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/starburstpisa.rb', line 17

def is_valid_date?(year, month, day)
  Date.valid_civil?(year, month, day)
end

#one_month_from_date(date) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/starburstpisa.rb', line 5

def one_month_from_date(date)
  year = date.year
  year = incre_year_on_december(year, date.month)
  next_month = (date.month % 12) + 1
  day = date.day
  if is_valid_date?(year, next_month, day)
    this_day_next_month = Date.new(year, next_month, day)
  else
    this_day_next_month  = last_day_of_the_month(year, next_month)
  end
  this_day_next_month
end

#sayhelloObject



2
3
4
# File 'lib/starburstpisa.rb', line 2

def sayhello
  'hello'
end