Class: Inferno::DSL::SuiteOption

Inherits:
Object
  • Object
show all
Includes:
Entities::Attributes
Defined in:
lib/inferno/dsl/suite_option.rb

Overview

This class is used to represent TestSuite-level options which are selected by the user, and can affect which tests/groups are displayed and run as well as the behavior of those tests.

Constant Summary collapse

ATTRIBUTES =
[
  :id,
  :title,
  :description,
  :list_options,
  :value
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Entities::Attributes

included

Constructor Details

#initialize(raw_params) ⇒ SuiteOption

Returns a new instance of SuiteOption.



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/inferno/dsl/suite_option.rb', line 28

def initialize(raw_params)
  params = raw_params.deep_symbolize_keys
  bad_params = params.keys - ATTRIBUTES

  raise Exceptions::UnknownAttributeException.new(bad_params, self.class) if bad_params.present?

  params
    .compact
    .each { |key, value| send("#{key}=", value) }

  self.id = id.to_sym if id.is_a? String
end

Instance Attribute Details

#descriptionObject



# File 'lib/inferno/dsl/suite_option.rb', line 21

#idObject



# File 'lib/inferno/dsl/suite_option.rb', line 21

#list_optionsObject



# File 'lib/inferno/dsl/suite_option.rb', line 21

#titleObject



# File 'lib/inferno/dsl/suite_option.rb', line 21

#valueObject



# File 'lib/inferno/dsl/suite_option.rb', line 21

Instance Method Details

#==(other) ⇒ Object



42
43
44
# File 'lib/inferno/dsl/suite_option.rb', line 42

def ==(other)
  id == other.id && value == other.value
end

#to_hashObject



47
48
49
50
51
# File 'lib/inferno/dsl/suite_option.rb', line 47

def to_hash
  self.class::ATTRIBUTES.each_with_object({}) do |attribute, hash|
    hash[attribute] = send(attribute)
  end.compact
end