class MoreHoliday::Holiday
Attributes
available_days[R]
file_path[R]
state[R]
year[R]
Public Class Methods
new(state, available_days: 0, file_path: nil, year: Date.today.year)
click to toggle source
# File lib/more_holiday/holiday.rb, line 8 def initialize state, available_days: 0, file_path: nil, year: Date.today.year @state = state @available_days = available_days @file_path = file_path @year = year end
Public Instance Methods
export_ical_file(path)
click to toggle source
# File lib/more_holiday/holiday.rb, line 34 def export_ical_file path export_suggestions.to_file(path, type: "ical") end
give_me_a_calender_file!(path)
click to toggle source
# File lib/more_holiday/holiday.rb, line 30 def give_me_a_calender_file! path export_ical_file(path) end
make_more_out_of_my_holidays!()
click to toggle source
# File lib/more_holiday/holiday.rb, line 15 def make_more_out_of_my_holidays! suggestions end
suggestions()
click to toggle source
# File lib/more_holiday/holiday.rb, line 19 def suggestions { holidays_to_take: calculator.suggestions, official_holidays: connector.holidays, info: { state: connector.state, officials_source: connector.source } } end
Private Instance Methods
calculator()
click to toggle source
# File lib/more_holiday/holiday.rb, line 44 def calculator @calculator ||= Calculator.new(connector.holidays, available_days) end
connector()
click to toggle source
# File lib/more_holiday/holiday.rb, line 40 def connector @connector ||= Connector.new(state, file_path: file_path, year: year) end
export_suggestions()
click to toggle source
# File lib/more_holiday/holiday.rb, line 48 def export_suggestions @export_suggestions ||= Exporter.new(calculator.suggestions.map{ |d| [d, "Take a break :)"] }) end