Class: TaskLoop::EndPointBoundaryRule

Inherits:
BoundaryRule show all
Defined in:
lib/taskloop/rules/end_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) ⇒ EndPointBoundaryRule

Returns a new instance of EndPointBoundaryRule.



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

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#descObject



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

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

#is_conform_rule?(last_exec_time) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/taskloop/rules/end_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)
  end_time = date_object.to_i
  return current <= end_time
end