Class: Knife::Clc::IpAssignment::Mapper
- Inherits:
-
Object
- Object
- Knife::Clc::IpAssignment::Mapper
- Defined in:
- lib/knife-clc/ip_assignment/mapper.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(params) ⇒ Mapper
constructor
A new instance of Mapper.
- #prepare_ip_params ⇒ Object
Constructor Details
#initialize(params) ⇒ Mapper
Returns a new instance of Mapper.
7 8 9 |
# File 'lib/knife-clc/ip_assignment/mapper.rb', line 7 def initialize(params) @config = params.fetch(:config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/knife-clc/ip_assignment/mapper.rb', line 5 def config @config end |
Instance Method Details
#prepare_ip_params ⇒ Object
11 12 13 14 15 16 |
# File 'lib/knife-clc/ip_assignment/mapper.rb', line 11 def prepare_ip_params { 'ports' => config[:clc_allowed_protocols], 'sourceRestrictions' => config[:clc_sources] }.delete_if { |_, value| value.nil? || value.empty? } end |