class ListStrategy
Attributes
date[R]
month[R]
year[R]
Public Class Methods
new(date, month, year)
click to toggle source
# File lib/list_strategy.rb, line 8 def initialize(date, month, year) @date = date @month = month @year = year end
Public Instance Methods
execute()
click to toggle source
# File lib/list_strategy.rb, line 14 def execute return list_by_month_and_year if @month && @year return list_by_month_current_year if @month && @year.nil? return list_by_year if @month.nil? && @year list_by_date end
Private Instance Methods
list_by_date()
click to toggle source
# File lib/list_strategy.rb, line 24 def list_by_date WorkLogController.new.list(@date) end
list_by_month_and_year()
click to toggle source
# File lib/list_strategy.rb, line 28 def list_by_month_and_year WorkLogController.new.find_by_month_and_year(@month, @year) end
list_by_month_current_year()
click to toggle source
# File lib/list_strategy.rb, line 32 def list_by_month_current_year WorkLogController.new.find_by_month_and_year(@month, Date.today.year) end
list_by_year()
click to toggle source
# File lib/list_strategy.rb, line 36 def list_by_year WorkLogController.new.find_by_year(@year) end