Class: CalendariumRomanum::CLI::Querier Private
- Inherits:
-
Object
- Object
- CalendariumRomanum::CLI::Querier
- Includes:
- Helper
- Defined in:
- lib/calendarium-romanum/cli/querier.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
“Queries” a Calendar. Builds liturgical calendar according to the specified options and prints calendar entries for the specified period.
Instance Method Summary collapse
- #call(date_str = nil) ⇒ Object private
-
#initialize(locale: :en, calendar: 'universal-en') ⇒ Querier
constructor
private
A new instance of Querier.
Methods included from Helper
Constructor Details
#initialize(locale: :en, calendar: 'universal-en') ⇒ Querier
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Querier.
11 12 13 14 |
# File 'lib/calendarium-romanum/cli/querier.rb', line 11 def initialize(locale: :en, calendar: 'universal-en') @locale = locale @calendar = calendar end |
Instance Method Details
#call(date_str = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/calendarium-romanum/cli/querier.rb', line 16 def call(date_str = nil) I18n.locale = @locale pcal = PerpetualCalendar.new sanctorale: sanctorale today = Date.today date_range = today..today if date_str begin date_range = DateParser.parse(date_str) rescue ArgumentError die! 'Invalid date.' end end date_range.each do |day| print_single_date(pcal, day) end end |