Class: GDK::ConfigType::Port
- Defined in:
- lib/gdk/config_type/port.rb
Instance Attribute Summary
Attributes inherited from Base
#builder, #parent, #user_value, #value
Instance Method Summary collapse
- #default_value ⇒ Object
-
#initialize(parent:, builder:, service_name:) ⇒ Port
constructor
A new instance of Port.
- #parse(value) ⇒ Object
Methods inherited from Base
#dump!, #root, #slug, #user_defined?, #validate!
Constructor Details
#initialize(parent:, builder:, service_name:) ⇒ Port
Returns a new instance of Port.
6 7 8 9 10 |
# File 'lib/gdk/config_type/port.rb', line 6 def initialize(parent:, builder:, service_name:) @service_name = service_name super(parent: parent, builder: builder) end |
Instance Method Details
#default_value ⇒ Object
20 21 22 |
# File 'lib/gdk/config_type/port.rb', line 20 def default_value super || config.port_manager.default_port_for_service(service_name) end |
#parse(value) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/gdk/config_type/port.rb', line 12 def parse(value) return super if parent.respond_to?(:enabled?) && !parent.enabled? super.tap do |validated_value| config.port_manager.claim(validated_value, service_name) end end |