Class: TerminalCalendar

Inherits:
Object
  • Object
show all
Defined in:
lib/terminal_calendar/selection/grid.rb,
lib/terminal_calendar.rb,
lib/terminal_calendar/month.rb,
lib/terminal_calendar/version.rb,
lib/terminal_calendar/date_picker.rb,
lib/terminal_calendar/selection/cell.rb,
lib/terminal_calendar/month/calendar_day.rb,
lib/terminal_calendar/selection/selector.rb,
lib/terminal_calendar/selection/null_cell.rb,
lib/terminal_calendar/selection/month_page.rb,
lib/terminal_calendar/selection/month_year_dialog.rb

Overview

rubocop:disable Naming::MethodParameterName

Defined Under Namespace

Modules: Selection Classes: DatePicker, Error, Month

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.all_monthsObject

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.

Stores a cache of month objects



37
38
39
# File 'lib/terminal_calendar.rb', line 37

def self.all_months
  @all_months ||= {}
end

.cal(month = Month.this_month()) ⇒ String

Returns the month page as a string.

Parameters:

  • month (Month) (defaults to: Month.this_month())

    month to render, defaults to the current month

Returns:

  • (String)

    the month page as a string



31
32
33
# File 'lib/terminal_calendar.rb', line 31

def self.cal(month=Month.this_month())
  Selection::MonthPage.build(month).render
end

.date_pickerArray<Date>

This method allows the user to select one or more days starting from the current month calendar.

Returns:

  • (Array<Date>)

    The selected days.



25
26
27
# File 'lib/terminal_calendar.rb', line 25

def self.date_picker
  TerminalCalendar::DatePicker.pick
end