class TokyoMetro::Modules::Db::Select::OperationDay
Public Class Methods
new( datetime )
click to toggle source
# File lib/tokyo_metro/modules/db/select/operation_day.rb, line 3 def initialize( datetime ) @time = datetime end
process( datetime )
click to toggle source
# File lib/tokyo_metro/modules/db/select/operation_day.rb, line 24 def self.process( datetime ) self.new( datetime ).process end
Public Instance Methods
holiday?()
click to toggle source
# File lib/tokyo_metro/modules/db/select/operation_day.rb, line 11 def holiday? ::HolidayJapan.check( ::Date.new( @time.year , @time.month , @time.day ) ) end
process()
click to toggle source
# File lib/tokyo_metro/modules/db/select/operation_day.rb, line 15 def process if saturday_or_sunday? or holiday? ::OperationDay.find_by( same_as: "custom:OperationDay:SaturdayHoliday" ) # ::OperationDay.find_by( same_as: "custom:OperationDay:SaturdaySundayHoliday" ) else ::OperationDay.find_by( same_as: "custom:OperationDay:Weekday" ) end end
saturday_or_sunday?()
click to toggle source
# File lib/tokyo_metro/modules/db/select/operation_day.rb, line 7 def saturday_or_sunday? @time.saturday? or @time.sunday? end