Class: TaskLoop::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/taskloop/rules/rule.rb

Constant Summary collapse

UNIT =
{
  :unknown     => 0,
  :minute      => 1,      # support interval/scope/specific syntax
  :hour        => 2,      # support interval/scope/specific syntax
  :day         => 3,      # support interval/scope/specific syntax
  :month       => 4,      # support interval/scope/specific syntax
  :year        => 5,      # support interval/scope/specific syntax
  :week        => 6,      # support scope/specific syntax
  :loop        => 7,      # only support loop syntax
  :date        => 8,      # only support date list syntax
  :time        => 9,      # only support time list syntax
  :full        => 10,     # only support boundary syntax
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(unit = :unknown) ⇒ Rule

Returns a new instance of Rule.



20
21
22
# File 'lib/taskloop/rules/rule.rb', line 20

def initialize(unit = :unknown)
  @unit = unit
end

Instance Attribute Details

#unitObject

Returns the value of attribute unit.



18
19
20
# File 'lib/taskloop/rules/rule.rb', line 18

def unit
  @unit
end

Instance Method Details

#descObject



28
29
30
# File 'lib/taskloop/rules/rule.rb', line 28

def desc
  "unit: #{unit.to_s}"
end

#is_conform_rule?(last_exec_time) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/taskloop/rules/rule.rb', line 24

def is_conform_rule?(last_exec_time)
  raise NotImplementedError, 'subclass need implement this method!'
end