module Aygabtu::Scope::Remaining

Public Class Methods

factory_methods() click to toggle source
# File lib/aygabtu/scope/remaining.rb, line 22
def self.factory_methods
  [:remaining_at]
end

Public Instance Methods

inspect_data() click to toggle source
Calls superclass method
# File lib/aygabtu/scope/remaining.rb, line 17
def inspect_data
  return super unless @data.key?(:remaining_at)
  super.merge(remaining_at: "CP #{@data[:remaining_at]}")
end
matches_route?(route) click to toggle source
Calls superclass method
# File lib/aygabtu/scope/remaining.rb, line 9
def matches_route?(route)
  return super unless @data.key?(:remaining_at)

  at_checkpoint = @data[:remaining_at]
  route_touched = route.marks.any? { |mark| mark.checkpoint <= at_checkpoint }
  !route_touched && super
end
remaining_at(checkpoint) click to toggle source
# File lib/aygabtu/scope/remaining.rb, line 4
def remaining_at(checkpoint)
  new_data = @data.dup.merge(remaining_at: checkpoint)
  self.class.new(new_data)
end