Class: Transpec::RecordBuilder
- Inherits:
-
Object
- Object
- Transpec::RecordBuilder
show all
- Defined in:
- lib/transpec/record.rb
Overview
This class is intended to be inherited to build complex record. The reasons why you should inherit this class rather than Record are:
* You need to care about String and Symbol around Record
* All record instances are kept in a Report until the end of Transpec process.
This mean that if a custom record keeps a syntax object as an ivar,
the AST kept by the syntax object won't be GCed.
Direct Known Subclasses
Syntax::CurrentExample::RecordBuilder, Syntax::ExampleGroup::ExplicitTypeMetadataRecordBuilder, Syntax::ExampleGroup::NonMonkeyPatchRecordBuilder, Syntax::Have::RecordBuilder, Syntax::Its::RecordBuilder, Syntax::MethodStub::AllowRecordBuilder, Syntax::MethodStub::DeprecatedMethodRecordBuilder, Syntax::MethodStub::NoMessageAllowanceRecordBuilder, Syntax::Mixin::AnyInstanceBlock::RecordBuilder, Syntax::Mixin::UselessAndReturn::RecordBuilder, Syntax::OnelinerShould::ExpectRecordBuilder, Syntax::RaiseError::RecordBuilder, Syntax::Should::RecordBuilder, Syntax::ShouldReceive::ExpectBaseRecordBuilder, Syntax::ShouldReceive::StubRecordBuilder
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.build(*args) ⇒ Object
97
98
99
|
# File 'lib/transpec/record.rb', line 97
def self.build(*args)
new(*args).build
end
|
.param_names(*names) ⇒ Object
101
102
103
104
105
106
107
|
# File 'lib/transpec/record.rb', line 101
def self.param_names(*names)
names.each_with_index do |name, index|
define_method(name) do
@initializer_params[index]
end
end
end
|
Instance Method Details
#build ⇒ Object
109
110
111
|
# File 'lib/transpec/record.rb', line 109
def build
Record.new(old_syntax, new_syntax, { type: type, annotation: annotation })
end
|