Class: Sitespec::Artifact
- Inherits:
-
Object
- Object
- Sitespec::Artifact
- Defined in:
- lib/sitespec/artifact.rb
Overview
“Artifact” is corresponding to each response body to an endpoint. This class has ActiveRecord-like interface like Sitespec::Artifact.create.
Class Method Summary collapse
-
.create(**args) ⇒ Sitespec::Artifact
Short-hand method to call ‘.new` and `#save`.
Instance Method Summary collapse
-
#initialize(example: nil, example_group: nil) ⇒ Artifact
constructor
A new instance of Artifact.
-
#save ⇒ false, true
Validate its attributes and generate a new file.
Constructor Details
#initialize(example: nil, example_group: nil) ⇒ Artifact
Returns a new instance of Artifact.
22 23 24 25 |
# File 'lib/sitespec/artifact.rb', line 22 def initialize(example: nil, example_group: nil) @example = example @example_group = example_group end |
Class Method Details
.create(**args) ⇒ Sitespec::Artifact
Short-hand method to call ‘.new` and `#save`
15 16 17 |
# File 'lib/sitespec/artifact.rb', line 15 def create(**args) new(**args).tap(&:save) end |
Instance Method Details
#save ⇒ false, true
Validate its attributes and generate a new file
29 30 31 32 33 34 35 36 37 |
# File 'lib/sitespec/artifact.rb', line 29 def save if valid? write increment true else false end end |