Class: Brutal::Configuration
- Inherits:
-
Object
- Object
- Brutal::Configuration
- Defined in:
- lib/brutal/configuration.rb
Overview
Brutal::Configuration
Constant Summary collapse
- DEFAULT_ACTUALS =
[].freeze
- DEFAULT_CONTEXTS =
{}.freeze
- DEFAULT_HEAD =
'# Brutal test suite'- DEFAULT_SUBJECT =
''
Instance Attribute Summary collapse
-
#actuals ⇒ Object
readonly
Specifies templates to challenge evaluated subjects & get results.
-
#contexts ⇒ Object
readonly
Specifies a list of variables to populate the subject’s template.
-
#header ⇒ Object
readonly
Specifies the code to execute before generating the test suite.
-
#subject ⇒ Object
readonly
Specifies the template of the code to be declined across contexts.
Class Method Summary collapse
-
.load(params) ⇒ Object
Load the configuration parameters.
Instance Method Summary collapse
-
#initialize(actuals:, contexts:, header:, subject:) ⇒ Configuration
constructor
Initialize a new configuration.
Constructor Details
#initialize(actuals:, contexts:, header:, subject:) ⇒ Configuration
Initialize a new configuration.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/brutal/configuration.rb', line 38 def initialize(actuals:, contexts:, header:, subject:) raise ::TypeError, actuals.inspect unless actuals.is_a?(::Array) raise ::TypeError, contexts.inspect unless contexts.is_a?(::Hash) raise ::TypeError, header.inspect unless header.is_a?(::String) raise ::TypeError, subject.inspect unless subject.is_a?(::String) @actuals = actuals @contexts = contexts @header = header @subject = subject end |
Instance Attribute Details
#actuals ⇒ Object (readonly)
Specifies templates to challenge evaluated subjects & get results.
26 27 28 |
# File 'lib/brutal/configuration.rb', line 26 def actuals @actuals end |
#contexts ⇒ Object (readonly)
Specifies a list of variables to populate the subject’s template.
29 30 31 |
# File 'lib/brutal/configuration.rb', line 29 def contexts @contexts end |
#header ⇒ Object (readonly)
Specifies the code to execute before generating the test suite.
32 33 34 |
# File 'lib/brutal/configuration.rb', line 32 def header @header end |
#subject ⇒ Object (readonly)
Specifies the template of the code to be declined across contexts.
35 36 37 |
# File 'lib/brutal/configuration.rb', line 35 def subject @subject end |
Class Method Details
.load(params) ⇒ Object
Load the configuration parameters.
16 17 18 19 20 21 22 23 |
# File 'lib/brutal/configuration.rb', line 16 def self.load(params) new( actuals: params.fetch('actuals', DEFAULT_ACTUALS), contexts: params.fetch('contexts', DEFAULT_CONTEXTS), header: params.fetch('header', DEFAULT_HEAD), subject: params.fetch('subject', DEFAULT_SUBJECT) ) end |