Class: IpRestriction::IpLoader
- Inherits:
-
Object
- Object
- IpRestriction::IpLoader
- Defined in:
- lib/ip_restriction/ip_loader.rb
Constant Summary collapse
- DEFAULT_IPS =
['127.0.0.1', '::1']
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ IpLoader
constructor
A new instance of IpLoader.
- #load ⇒ Object
Constructor Details
#initialize(file_path) ⇒ IpLoader
Returns a new instance of IpLoader.
9 10 11 |
# File 'lib/ip_restriction/ip_loader.rb', line 9 def initialize(file_path) @file_path = file_path end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
7 8 9 |
# File 'lib/ip_restriction/ip_loader.rb', line 7 def file_path @file_path end |
Instance Method Details
#load ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/ip_restriction/ip_loader.rb', line 13 def load unless File.exist? file_path warn "LwIpRestriction: file #{file_path} does not exist" return DEFAULT_IPS end YAML.load_file(file_path)['ips'] end |