Class: TaskLoop::StartPointBoundaryRule

Inherits:
BoundaryRule show all
Defined in:
lib/taskloop/rules/start_point_boundary_rule.rb

Constant Summary

Constants inherited from BoundaryRule

BoundaryRule::BOUNDARY

Constants inherited from Rule

Rule::UNIT

Instance Attribute Summary collapse

Attributes inherited from BoundaryRule

#boundary

Attributes inherited from Rule

#unit

Instance Method Summary collapse

Constructor Details

#initialize(unit, value) ⇒ StartPointBoundaryRule

Returns a new instance of StartPointBoundaryRule.



4
5
6
7
# File 'lib/taskloop/rules/start_point_boundary_rule.rb', line 4

def initialize(unit, value)
  super unit, :start
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/taskloop/rules/start_point_boundary_rule.rb', line 3

def value
  @value
end

Instance Method Details

#descObject



17
18
19
# File 'lib/taskloop/rules/start_point_boundary_rule.rb', line 17

def desc
  super + " from #{value}"
end

#is_conform_rule?(last_exec_time) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/taskloop/rules/start_point_boundary_rule.rb', line 9

def is_conform_rule?(last_exec_time)
  current = Time.now.to_i
  date_format = "%Y-%m-%d %H:%M:%S"
  date_object = Time.strptime(value, date_format)
  start_time = date_object.to_i
  return current >= start_time
end