Class: Lita::Handlers::JenkinsClient::BuildParam
- Inherits:
-
Object
- Object
- Lita::Handlers::JenkinsClient::BuildParam
- Defined in:
- lib/lita/handlers/jenkins_client/build_param.rb
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, name:, description:, default: '', choices: []) ⇒ BuildParam
constructor
A new instance of BuildParam.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, name:, description:, default: '', choices: []) ⇒ BuildParam
Returns a new instance of BuildParam.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 12 def initialize(type: , name: , description: , default: '', choices: []) @type, @name, @description, @default, @choices = type, name, description, default, choices if type == 'choice' @default = choices[0] end if wrong_type? raise ArgumentError, self.class.print_supported_types end self.value = @default end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
3 4 5 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 3 def choices @choices end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
3 4 5 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 3 def default @default end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 3 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 3 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 3 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 3 def value @value end |
Class Method Details
.print_supported_types ⇒ Object
8 9 10 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 8 def self.print_supported_types "Currently available param types: #{self.supported_types.join(' ')}" end |
.supported_types ⇒ Object
4 5 6 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 4 def self.supported_types ['boolean', 'string', 'choice'].freeze end |
Instance Method Details
#to_h ⇒ Object
56 57 58 |
# File 'lib/lita/handlers/jenkins_client/build_param.rb', line 56 def to_h {@name => @value} end |