lib/timeboss/calendar.rb in timeboss-0.0.10 vs lib/timeboss/calendar.rb in timeboss-0.1.0

- old
+ new

@@ -5,17 +5,31 @@ %w[day week month quarter half year].each { |f| require_relative "./calendar/#{f}" } %w[waypoints period parser].each { |f| require_relative "./calendar/#{f}" } require_relative './calendar/support/month_basis' module TimeBoss + # A calendar is built upon a basis, and provides methods for period identification and navigation. class Calendar include Waypoints + + # @!method parse + # Parse an identifier into a unit or period. + # Valid identifiers can include simple units (like "2020Q3", "2020M8W3", "last_quarter"), + # mathematical expressions (like "this_month+6"), + # or period expressions (like "2020W1..2020W8", "this_quarter-2..next_quarter") + # @param identifier [String] + # @return [Support::Unit, Period] + delegate :parse, to: :parser + # Get a name by which this calendar can be referenced. + # @return [String] def name self.class.to_s.demodulize.underscore end + # Get a friendly title for this calendar. + # @return [String] def title name.titleize end protected