Module: ScheduleAttributes

Defined in:
lib/schedule_attributes/core.rb,
lib/schedule_attributes/input.rb,
lib/schedule_attributes/railtie.rb,
lib/schedule_attributes/version.rb,
lib/schedule_attributes/serializer.rb,
lib/schedule_attributes/rule_parser.rb,
lib/schedule_attributes/time_helpers.rb,
lib/schedule_attributes/configuration.rb

Defined Under Namespace

Modules: ActiveRecord, Core, DateHelpers, Model, RuleParser, TimeHelpers Classes: Configuration, FormBuilder, Input, Railtie, Serializer

Constant Summary collapse

DEFAULT_ATTRIBUTE_KEY =
:schedule
DAY_NAMES =
Date::DAYNAMES.map(&:downcase).map(&:to_sym)
VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.configureObject Also known as: configuration



13
14
15
16
17
18
19
# File 'lib/schedule_attributes/configuration.rb', line 13

def configure
  @configuration ||= Configuration.new
  if block_given?
    yield @configuration
  end
  return @configuration
end

.default_scheduleObject



16
17
18
19
20
# File 'lib/schedule_attributes/core.rb', line 16

def default_schedule
  IceCube::Schedule.new(TimeHelpers.today).tap do |s|
    s.add_recurrence_rule(IceCube::Rule.daily)
  end
end

.parse_rule(options) ⇒ Object



22
23
24
# File 'lib/schedule_attributes/core.rb', line 22

def parse_rule(options)
  RuleParser[options[:interval_unit]].parse(options)
end