Class: Brutal::Manifest
- Inherits:
-
Object
- Object
- Brutal::Manifest
- Defined in:
- lib/brutal/manifest.rb,
lib/brutal/manifest/file.rb,
lib/brutal/manifest/file/name.rb
Overview
Brutal YAML manifest file parser.
Defined Under Namespace
Classes: File
Constant Summary collapse
- ACTUALS_KEY =
The actuals top-level section key.
"actuals"
- CONTEXTS_KEY =
The contexts top-level section key.
"contexts"
- HEADER_KEY =
The header top-level section key.
"header"
- BEFORE_KEY =
The before top-level section key.
"before"
- SUBJECT_KEY =
The subject top-level section key.
"subject"
- AFTER_KEY =
The after top-level section key.
"after"
- FOOTER_KEY =
The footer top-level section key.
"footer"
- DEFAULT_ACTUALS =
Default actuals collection.
[].freeze
- DEFAULT_CONTEXTS =
Default contexts collection.
{}.freeze
- DEFAULT_HEADER =
Default header code to evaluate.
""
- DEFAULT_BEFORE =
Default before code to evaluate.
""
- DEFAULT_AFTER =
Default after code to evaluate.
""
- DEFAULT_FOOTER =
Default footer code to evaluate.
""
Instance Attribute Summary collapse
-
#actuals ⇒ Object
readonly
Specifies templates to challenge evaluated subjects & get results.
-
#after ⇒ Object
readonly
Specifies a block of lines to be executed after each example.
-
#before ⇒ Object
readonly
Specifies a block of lines to be executed before each example.
-
#contexts ⇒ Object
readonly
Specifies a list of variables to populate the subject's template.
-
#footer ⇒ Object
readonly
Specifies a block of lines to be executed once after all examples.
-
#header ⇒ Object
readonly
Specifies a block of lines to be executed once before all examples.
-
#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.
-
.parse_file(pathname) ⇒ Object
Parse a file at `pathname`.
Instance Method Summary collapse
-
#initialize(actuals:, contexts:, header:, before:, subject:, after:, footer:) ⇒ Manifest
constructor
Initialize a new configuration.
Constructor Details
#initialize(actuals:, contexts:, header:, before:, subject:, after:, footer:) ⇒ Manifest
Initialize a new configuration.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/brutal/manifest.rb', line 89 def initialize(actuals:, contexts:, header:, before:, subject:, after:, footer:) 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, before.inspect unless before.is_a?(::String) raise ::TypeError, subject.inspect unless subject.is_a?(::String) raise ::TypeError, after.inspect unless after.is_a?(::String) raise ::TypeError, .inspect unless .is_a?(::String) @actuals = actuals @contexts = contexts @header = header @before = before @subject = subject @after = after @footer = end |
Instance Attribute Details
#actuals ⇒ Object (readonly)
Specifies templates to challenge evaluated subjects & get results.
68 69 70 |
# File 'lib/brutal/manifest.rb', line 68 def actuals @actuals end |
#after ⇒ Object (readonly)
Specifies a block of lines to be executed after each example.
83 84 85 |
# File 'lib/brutal/manifest.rb', line 83 def after @after end |
#before ⇒ Object (readonly)
Specifies a block of lines to be executed before each example.
77 78 79 |
# File 'lib/brutal/manifest.rb', line 77 def before @before end |
#contexts ⇒ Object (readonly)
Specifies a list of variables to populate the subject's template.
71 72 73 |
# File 'lib/brutal/manifest.rb', line 71 def contexts @contexts end |
#footer ⇒ Object (readonly)
Specifies a block of lines to be executed once after all examples.
86 87 88 |
# File 'lib/brutal/manifest.rb', line 86 def @footer end |
#header ⇒ Object (readonly)
Specifies a block of lines to be executed once before all examples.
74 75 76 |
# File 'lib/brutal/manifest.rb', line 74 def header @header end |
#subject ⇒ Object (readonly)
Specifies the template of the code to be declined across contexts.
80 81 82 |
# File 'lib/brutal/manifest.rb', line 80 def subject @subject end |
Class Method Details
.load(params) ⇒ Object
Load the configuration parameters.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/brutal/manifest.rb', line 55 def self.load(params) new( actuals: params.fetch(ACTUALS_KEY, DEFAULT_ACTUALS), contexts: params.fetch(CONTEXTS_KEY, DEFAULT_CONTEXTS), header: params.fetch(HEADER_KEY, DEFAULT_HEADER), before: params.fetch(BEFORE_KEY, DEFAULT_BEFORE), subject: params.fetch(SUBJECT_KEY), after: params.fetch(AFTER_KEY, DEFAULT_AFTER), footer: params.fetch(FOOTER_KEY, DEFAULT_FOOTER) ) end |