class Happybirthday::Birthday

Attributes

date[R]

Public Class Methods

new(birthday) click to toggle source

Happybirthday::Birtyday initializer @param birthday [Date,String] birthday Date or date like String (ex.“2018-05-08”) @return [Happybirthday::Birtyday]

# File lib/happybirthday/birthday.rb, line 8
def initialize(birthday)
  @date = to_date(birthday)
end

Public Instance Methods

age() click to toggle source

Get Happybirthday::Age object @return [Happybirthday::Age]

# File lib/happybirthday/birthday.rb, line 21
def age
  Age.new(birthday: self)
end
today?() click to toggle source

Judge whether today is birthday or not @return [Boolean]

# File lib/happybirthday/birthday.rb, line 14
def today?
  today = Date.today
  date.month == today.month && date.day == today.day
end