Class: Macker::Config
- Inherits:
-
Object
- Object
- Macker::Config
- Defined in:
- lib/macker/config.rb
Overview
Configuration class
Instance Method Summary collapse
-
#initialize ⇒ OpenStruct
constructor
Initialization with default configuration.
-
#method_missing(method, *args, &block) ⇒ Object
Send missing methods to the OpenStruct configuration.
Constructor Details
permalink #initialize ⇒ OpenStruct
Initialization with default configuration.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/macker/config.rb', line 8 def initialize @config = OpenStruct.new( # Full URL of OUI text file oui_full_url: 'http://standards-oui.ieee.org/oui.txt', # A common user agent user_agent: 'Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0', # Will expire the vendors in one day ttl_in_seconds: 86_400, # Can be a string, pathname or proc cache: File.(File.dirname(__FILE__) + '/../../data/oui_*.txt'), # Expiration can be checked manually auto_expire: true, # Stale can be checked manually auto_stale: true ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
permalink #method_missing(method, *args, &block) ⇒ Object
Send missing methods to the OpenStruct configuration.
30 31 32 |
# File 'lib/macker/config.rb', line 30 def method_missing(method, *args, &block) @config.send(method, *args, &block) end |