Module: AuthorizedNetworks
- Defined in:
- lib/authorized_networks.rb,
lib/authorized_networks/error.rb,
lib/authorized_networks/config.rb,
lib/authorized_networks/railtie.rb,
lib/authorized_networks/version.rb,
lib/authorized_networks/instance.rb,
lib/authorized_networks/controller_extension.rb
Defined Under Namespace
Modules: ControllerExtension Classes: Config, Error, Instance, NetworksConfigFileNotFoundError, Railtie, UnauthorizedNetworkError
Constant Summary collapse
- VERSION =
'1.0.2'
Class Method Summary collapse
-
.config ⇒ Object
Provide a configuration.
-
.configure(&block) ⇒ AuthorizedNetworks::Config
Provide a configuration object to the given block and reteurn the config.
-
.instance ⇒ AuthorizedNetwork::Instance
Provide an instance for global use.
-
.valid_ip!(ip, options = {}) ⇒ True
Is the given IP a valid IP? Raises an error if not.
-
.valid_ip?(ip, options = {}) ⇒ Boolean
Is the given IP a valid IP on the global instance?.
Class Method Details
.config ⇒ Object
Provide a configuration
15 16 17 |
# File 'lib/authorized_networks.rb', line 15 def self.config @config ||= Config.new end |
.configure(&block) ⇒ AuthorizedNetworks::Config
Provide a configuration object to the given block and reteurn the config
22 23 24 25 |
# File 'lib/authorized_networks.rb', line 22 def self.configure(&block) block.call(config) config end |
.instance ⇒ AuthorizedNetwork::Instance
Provide an instance for global use
30 31 32 |
# File 'lib/authorized_networks.rb', line 30 def self.instance @instance ||= Instance.new(config) end |
.valid_ip!(ip, options = {}) ⇒ True
Is the given IP a valid IP? Raises an error if not
45 46 47 |
# File 'lib/authorized_networks.rb', line 45 def self.valid_ip!(ip, = {}) instance.valid_ip!(ip, ) end |
.valid_ip?(ip, options = {}) ⇒ Boolean
Is the given IP a valid IP on the global instance?
37 38 39 |
# File 'lib/authorized_networks.rb', line 37 def self.valid_ip?(ip, = {}) instance.valid_ip?(ip, ) end |