Class: BankHolidays::BankHoliday

Inherits:
Object
  • Object
show all
Defined in:
lib/bank_holidays.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date, summary = '') ⇒ BankHoliday

Returns a new instance of BankHoliday.



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

def initialize(date, summary='')
  @date = date
  @summary = summary
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



16
17
18
# File 'lib/bank_holidays.rb', line 16

def date
  @date
end

#summaryObject (readonly)

Returns the value of attribute summary.



16
17
18
# File 'lib/bank_holidays.rb', line 16

def summary
  @summary
end

Instance Method Details

#as_jsonObject



22
23
24
25
26
27
28
# File 'lib/bank_holidays.rb', line 22

def as_json
  {
    title: summary,
    start: date.rfc822,
    end: date.rfc822
  }
end