Class: Bifrossht::Config::Connection
- Defined in:
- lib/bifrossht/config/connection.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #match ⇒ Object
- #match_addr ⇒ Object
- #name ⇒ Object
- #parameters ⇒ Object
- #skip_probe ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Connection
Returns a new instance of Connection.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/bifrossht/config/connection.rb', line 4 def initialize( = {}) super validate_presence 'type', 'name' validate_type 'type', String validate_type 'name', String validate_boolean 'skip_probe' validate_type 'parameters', Hash validate_type 'match', Array validate_type 'match_addr', Array end |
Instance Method Details
#match ⇒ Object
32 33 34 35 36 |
# File 'lib/bifrossht/config/connection.rb', line 32 def match return [] if @options['match'].nil? @options['match'].map { |re| Regexp.new re } end |
#match_addr ⇒ Object
38 39 40 41 42 |
# File 'lib/bifrossht/config/connection.rb', line 38 def match_addr return [] if @options['match_addr'].nil? @options['match_addr'].map { |ip| IPAddr.new ip } end |
#name ⇒ Object
20 21 22 |
# File 'lib/bifrossht/config/connection.rb', line 20 def name @options['name'] end |
#parameters ⇒ Object
28 29 30 |
# File 'lib/bifrossht/config/connection.rb', line 28 def parameters @options['parameters'] || {} end |
#skip_probe ⇒ Object
24 25 26 |
# File 'lib/bifrossht/config/connection.rb', line 24 def skip_probe @options['skip_probe'] || false end |
#type ⇒ Object
16 17 18 |
# File 'lib/bifrossht/config/connection.rb', line 16 def type @options['type'] end |