Class: ActiveAccess::Utility::Config
- Inherits:
-
HashMapper
- Object
- Hash
- HashMapper
- ActiveAccess::Utility::Config
- Defined in:
- lib/active-access/utility/config.rb
Constant Summary
Constants inherited from HashMapper
Instance Method Summary collapse
- #allowed_ips=(ip_addresses) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #protected_domains=(domains) ⇒ Object
Methods inherited from HashMapper
#key?, #method_missing, #respond_to_missing?, #update!
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/active-access/utility/config.rb', line 8 def initialize(*) super if protected_domains.nil? self["protected_domains"] = {} elsif protected_domains.is_a?(Array) domains = protected_domains self["protected_domains"] = {} self.protected_domains = domains end self.allowed_ips = allowed_ips self.enabled = true if enabled.nil? self. = "Resource Not Found" if .nil? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveAccess::Utility::HashMapper
Instance Method Details
#allowed_ips=(ip_addresses) ⇒ Object
24 25 26 |
# File 'lib/active-access/utility/config.rb', line 24 def allowed_ips=(ip_addresses) self["allowed_ips"] = Set.new(split_or_ship(ip_addresses)) end |
#protected_domains=(domains) ⇒ Object
28 29 30 31 |
# File 'lib/active-access/utility/config.rb', line 28 def protected_domains=(domains) return if domains.blank? split_or_ship(domains).each { |domain| self["protected_domains"][domain.to_s] = true } end |