Class: Gitlab::Ci::Build::Port
- Inherits:
-
Object
- Object
- Gitlab::Ci::Build::Port
- Defined in:
- lib/gitlab/ci/build/port.rb
Constant Summary collapse
- DEFAULT_PORT_NAME =
'default_port'
- DEFAULT_PORT_PROTOCOL =
'http'
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Instance Method Summary collapse
-
#initialize(port) ⇒ Port
constructor
A new instance of Port.
- #valid? ⇒ Boolean
Constructor Details
#initialize(port) ⇒ Port
Returns a new instance of Port.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gitlab/ci/build/port.rb', line 12 def initialize(port) @name = DEFAULT_PORT_NAME @protocol = DEFAULT_PORT_PROTOCOL case port when Integer @number = port when Hash @number = port[:number] @protocol = port.fetch(:protocol, @protocol) @name = port.fetch(:name, @name) end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/gitlab/ci/build/port.rb', line 10 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
10 11 12 |
# File 'lib/gitlab/ci/build/port.rb', line 10 def number @number end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
10 11 12 |
# File 'lib/gitlab/ci/build/port.rb', line 10 def protocol @protocol end |
Instance Method Details
#valid? ⇒ Boolean
26 27 28 |
# File 'lib/gitlab/ci/build/port.rb', line 26 def valid? @number.present? end |