Class: Handcart::Strategies::ContainmentStrategy
- Inherits:
-
BaseIpStrategy
- Object
- BaseIpStrategy
- Handcart::Strategies::ContainmentStrategy
- Defined in:
- lib/handcart/strategies/containment_strategy.rb
Instance Attribute Summary
Attributes inherited from BaseIpStrategy
Instance Method Summary collapse
-
#initialize ⇒ ContainmentStrategy
constructor
This strategy simply checks to see if the permitted list of IP Addresses for the current handcart has an entry for the foreign IP Address.
- #is_in_range?(foreign_ip_address, handcart) ⇒ Boolean
Methods inherited from BaseIpStrategy
Constructor Details
#initialize ⇒ ContainmentStrategy
This strategy simply checks to see if the permitted list of IP Addresses for the current handcart has an entry for the foreign IP Address
7 8 9 |
# File 'lib/handcart/strategies/containment_strategy.rb', line 7 def initialize @strategy = :containment end |
Instance Method Details
#is_in_range?(foreign_ip_address, handcart) ⇒ Boolean
11 12 13 |
# File 'lib/handcart/strategies/containment_strategy.rb', line 11 def is_in_range?(foreign_ip_address, handcart) handcart.ip_addresses.permitted.include?(foreign_ip_address) end |