Class: ScoutAgent::Order::CheckInOrder
- Inherits:
-
ScoutAgent::Order
- Object
- ScoutAgent::Order
- ScoutAgent::Order::CheckInOrder
- Defined in:
- lib/scout_agent/order/check_in_order.rb
Constant Summary collapse
- MATCH_RE =
/\A\s*check[-_]?in(?:\s+(.+?))?\s*\z/
Constants inherited from ScoutAgent::Order
Instance Attribute Summary
Attributes inherited from ScoutAgent::Order
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ScoutAgent::Order
can_handle?, inherited, #initialize, load_all, log, #log, log=, master_agent, match?, #notify_master, subclasses
Constructor Details
This class inherits a constructor from ScoutAgent::Order
Class Method Details
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/scout_agent/order/check_in_order.rb', line 18 def execute if id_str = match_details.captures.first ids = id_str.scan(/\d+/).map { |n| n.to_i } unless ids.empty? s = ids.size == 1 ? "" : "s" ids_str = case ids.size when 1 then ids.first.to_s when 2 then ids.join(" and ") else ids[0..-2].join(", ") + ", and #{ids.last}" end log.info("Clearing wait time#{s} for mission#{s} (#{ids_str}).") self.class.mission_log.reset_missions(*ids) end end log.info("Requesting an immediate check-in.") notify_master end |