lib/timeboss/calendar/period.rb in timeboss-1.0.1 vs lib/timeboss/calendar/period.rb in timeboss-1.0.5

- old
+ new

@@ -1,6 +1,7 @@ # frozen_string_literal: true + module TimeBoss class Calendar class Period attr_reader :begin, :end @@ -26,12 +27,12 @@ # Get a stringified representation of this period. # @return [String] %i[name title to_s].each do |message| define_method(message) do - text = self.begin.send(message) - text = "#{text} #{Parser::RANGE_DELIMITER} #{self.end.send(message)}" unless self.end == self.begin + text = self.begin.public_send(message) + text = "#{text} #{Parser::RANGE_DELIMITER} #{self.end.public_send(message)}" unless self.end == self.begin text end end # @@ -110,25 +111,25 @@ to_range.include?(Date.today) end %w[day week month quarter half year].each do |size| define_method(size.pluralize) do - entry = calendar.send("#{size}_for", self.begin.start_date) + entry = calendar.public_send("#{size}_for", self.begin.start_date) build_entries entry end define_method(size) do |index = nil| - entries = send(size.pluralize) + entries = public_send(size.pluralize) return entries[index - 1] unless index.nil? return nil unless entries.length == 1 entries.first end end # Express this period as a date range. # @return [Range<Date, Date>] def to_range - @_to_range ||= start_date .. end_date + @_to_range ||= start_date..end_date end def inspect "#<#{self.class.name}[#{self.begin.inspect}..#{self.end.inspect}] start_date=#{start_date}, end_date=#{end_date}>" end