Module: DateBook
- Defined in:
- lib/date_book.rb,
lib/date_book/engine.rb,
lib/date_book/version.rb,
lib/date_book/configuration.rb,
lib/date_book/concerns/ability.rb,
lib/generators/date_book/utils.rb,
app/helpers/date_book/events_helper.rb,
lib/date_book/concerns/acts_as_event.rb,
lib/date_book/concerns/acts_as_owner.rb,
lib/date_book/concerns/acts_as_ownable.rb,
lib/date_book/concerns/acts_as_calendar.rb,
lib/date_book/concerns/acts_as_schedule.rb,
app/helpers/date_book/application_helper.rb,
app/controllers/date_book/events_controller.rb,
app/controllers/date_book/graphql_controller.rb,
app/controllers/date_book/calendars_controller.rb,
app/controllers/date_book/date_book_controller.rb,
lib/date_book/concerns/acts_as_event_occurrence.rb,
lib/generators/date_book/install/install_generator.rb
Overview
Defined Under Namespace
Modules: Ability, ActsAsCalendar, ActsAsEvent, ActsAsEventOccurrence, ActsAsOwnable, ActsAsOwner, ActsAsSchedule, ApplicationHelper, EventsHelper, Generators
Classes: CalendarsController, Configuration, DateBookController, Engine, EventsController, GraphqlController, InstallGenerator
Constant Summary
collapse
- VERSION =
File.read(File.expand_path('../../../VERSION', __FILE__))
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
10
11
12
|
# File 'lib/date_book/configuration.rb', line 10
def self.configuration
@configuration ||= DateBook::Configuration.new
end
|
5
6
7
8
|
# File 'lib/date_book/configuration.rb', line 5
def self.configure(configuration = DateBook::Configuration.new)
block_given? && yield(configuration)
@configuration = configuration
end
|
.version_string ⇒ Object
7
8
9
|
# File 'lib/date_book/version.rb', line 7
def self.version_string
"DateBook version #{DateBook::VERSION}"
end
|
.week_start_index ⇒ Object
26
27
28
29
30
|
# File 'lib/date_book/configuration.rb', line 26
def self.week_start_index
@week_start_index ||= Date::DAYNAMES.find_index(
configuration.week_starts_on
)
end
|
.weekdays ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/date_book/configuration.rb', line 14
def self.weekdays
return @weekdays if @weekdays
initial_days = Date::DAYNAMES.map.with_index do |x, i|
OpenStruct.new(id: i, name: x, slug: x.downcase)
end
@weekdays = initial_days.sort_by do |value|
(value.id - week_start_index) % 7
end
end
|