Class: CalendariumRomanum::CLI Private
- Includes:
- Helper
- Defined in:
- lib/calendarium-romanum/cli.rb,
lib/calendarium-romanum/cli.rb,
lib/calendarium-romanum/cli/dumper.rb,
lib/calendarium-romanum/cli/helper.rb,
lib/calendarium-romanum/cli/querier.rb,
lib/calendarium-romanum/cli/comparator.rb,
lib/calendarium-romanum/cli/date_parser.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.
Implementation of the calendariumrom
executable. Not loaded by default when you require
the gem.
Defined Under Namespace
Modules: Helper Classes: Comparator, DateParser, Dumper, Querier
Instance Method Summary collapse
- #calendars ⇒ Object private
- #cmp(a, b) ⇒ Object private
- #dump(year) ⇒ Object private
- #errors(*files) ⇒ Object private
- #id(file) ⇒ Object private
- #merge(*files) ⇒ Object private
- #query(date_str = nil) ⇒ Object private
- #version ⇒ Object private
Methods included from Helper
Instance Method Details
#calendars ⇒ 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.
41 42 43 |
# File 'lib/calendarium-romanum/cli.rb', line 41 def calendars Data.each {|c| puts c.siglum } end |
#cmp(a, b) ⇒ 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.
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/calendarium-romanum/cli.rb', line 61 def cmp(a, b) properties = Comparator::DEFAULT_PROPERTIES .each_key do |k| if k.start_with? 'no_' properties.delete k.sub('no_', '').to_sym else properties << k.to_sym end end Comparator.new(properties).call(a, b) || exit(1) end |
#dump(year) ⇒ 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.
91 92 93 |
# File 'lib/calendarium-romanum/cli.rb', line 91 def dump(year) Dumper.new.regression_tests_dump year.to_i end |
#errors(*files) ⇒ 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.
46 47 48 49 50 51 52 53 54 |
# File 'lib/calendarium-romanum/cli.rb', line 46 def errors(*files) files.each do |path| begin sanctorale_from_path path rescue Errno::ENOENT, InvalidDataError => err die! err. end end end |
#id(file) ⇒ 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.
82 83 84 85 86 87 88 |
# File 'lib/calendarium-romanum/cli.rb', line 82 def id(file) sanctorale_from_path(file).each_day do |_, celebrations| celebrations.each do |c| puts c.symbol if c.symbol end end end |
#merge(*files) ⇒ 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.
75 76 77 78 79 |
# File 'lib/calendarium-romanum/cli.rb', line 75 def merge(*files) sanctoralia = files.collect {|path| sanctorale_from_path path } merged = SanctoraleFactory.create_layered *sanctoralia SanctoraleWriter.new(front_matter: [:front_matter]).write merged, STDOUT end |
#query(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.
34 35 36 37 38 |
# File 'lib/calendarium-romanum/cli.rb', line 34 def query(date_str = nil) Querier .new(locale: [:locale], calendar: [:calendar]) .call(date_str) end |
#version ⇒ 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.
96 97 98 99 |
# File 'lib/calendarium-romanum/cli.rb', line 96 def version puts 'calendarium-romanum CLI' puts "calendarium-romanum: version #{CalendariumRomanum::VERSION}, released #{CalendariumRomanum::RELEASE_DATE}" end |