Class: Transpec::Syntax
- Inherits:
-
Object
show all
- Extended by:
- Collection
- Includes:
- DynamicAnalysis, Rewritable
- Defined in:
- lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax/its.rb,
lib/transpec/syntax/have.rb,
lib/transpec/syntax/hook.rb,
lib/transpec/syntax/allow.rb,
lib/transpec/syntax/double.rb,
lib/transpec/syntax/expect.rb,
lib/transpec/syntax/should.rb,
lib/transpec/syntax/example.rb,
lib/transpec/syntax/pending.rb,
lib/transpec/syntax/receive.rb,
lib/transpec/syntax/be_close.rb,
lib/transpec/syntax/operator.rb,
lib/transpec/syntax/be_boolean.rb,
lib/transpec/syntax/mixin/send.rb,
lib/transpec/syntax/method_stub.rb,
lib/transpec/syntax/raise_error.rb,
lib/transpec/syntax/example_group.rb,
lib/transpec/syntax/mixin/metadata.rb,
lib/transpec/syntax/should_receive.rb,
lib/transpec/syntax/current_example.rb,
lib/transpec/syntax/mixin/examplish.rb,
lib/transpec/syntax/oneliner_should.rb,
lib/transpec/syntax/rspec_configure.rb,
lib/transpec/syntax/mixin/block_owner.rb,
lib/transpec/syntax/mixin/expect_base.rb,
lib/transpec/syntax/mixin/rspec_rails.rb,
lib/transpec/syntax/mixin/should_base.rb,
lib/transpec/syntax/matcher_definition.rb,
lib/transpec/syntax/mixin/expectizable.rb,
lib/transpec/syntax/mixin/monkey_patch.rb,
lib/transpec/syntax/have/record_builder.rb,
lib/transpec/syntax/have/source_builder.rb,
lib/transpec/syntax/mixin/matcher_owner.rb,
lib/transpec/syntax/mixin/owned_matcher.rb,
lib/transpec/syntax/mixin/messaging_host.rb,
lib/transpec/syntax/have/dynamic_analysis.rb,
lib/transpec/syntax/rspec_configure/mocks.rb,
lib/transpec/syntax/mixin/context_sensitive.rb,
lib/transpec/syntax/mixin/any_instance_block.rb,
lib/transpec/syntax/mixin/useless_and_return.rb,
lib/transpec/syntax/rspec_configure/framework.rb,
lib/transpec/syntax/mixin/no_message_allowance.rb,
lib/transpec/syntax/rspec_configure/expectations.rb,
lib/transpec/syntax/mixin/monkey_patch_any_instance.rb,
lib/transpec/syntax/rspec_configure/config_modification.rb
Direct Known Subclasses
Allow, BeBoolean, BeClose, CurrentExample, Double, Example, ExampleGroup, Expect, Have, Hook, Its, MatcherDefinition, MethodStub, OnelinerShould, Operator, Pending, RSpecConfigure, RaiseError, Receive, Should, ShouldReceive
Defined Under Namespace
Modules: Collection, Dispatcher, DynamicAnalysis, Mixin, ModuleUtil, Rewritable
Classes: Allow, BeBoolean, BeClose, CurrentExample, Double, Example, ExampleGroup, Expect, Have, Hook, Its, MatcherDefinition, MethodStub, OnelinerShould, Operator, Pending, RSpecConfigure, RaiseError, Receive, Should, ShouldReceive
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Collection
all_syntaxes, inherited, mixins, require_all, standalone_syntaxes
#register_dynamic_analysis_request
Constructor Details
#initialize(node, source_rewriter = nil, runtime_data = nil, report = nil) ⇒ Syntax
Returns a new instance of Syntax.
158
159
160
161
162
163
|
# File 'lib/transpec/syntax.rb', line 158
def initialize(node, source_rewriter = nil, runtime_data = nil, report = nil)
@node = node
@source_rewriter = source_rewriter
@runtime_data = runtime_data || DynamicAnalyzer::RuntimeData.new
@report = report || Report.new
end
|
Instance Attribute Details
#node ⇒ Object
Returns the value of attribute node.
148
149
150
|
# File 'lib/transpec/syntax.rb', line 148
def node
@node
end
|
#report ⇒ Object
Returns the value of attribute report.
148
149
150
|
# File 'lib/transpec/syntax.rb', line 148
def report
@report
end
|
#runtime_data ⇒ Object
Returns the value of attribute runtime_data.
148
149
150
|
# File 'lib/transpec/syntax.rb', line 148
def runtime_data
@runtime_data
end
|
#source_rewriter ⇒ Object
Returns the value of attribute source_rewriter.
148
149
150
|
# File 'lib/transpec/syntax.rb', line 148
def source_rewriter
@source_rewriter
end
|
Class Method Details
.snake_case_name ⇒ Object
154
155
156
|
# File 'lib/transpec/syntax.rb', line 154
def self.snake_case_name
@snake_cake_name ||= ModuleUtil.snake_case_name(name)
end
|
.standalone? ⇒ Boolean
150
151
152
|
# File 'lib/transpec/syntax.rb', line 150
def self.standalone?
true
end
|
Instance Method Details
#add_record(*args) ⇒ Object
193
194
195
196
197
198
199
200
201
|
# File 'lib/transpec/syntax.rb', line 193
def add_record(*args)
record = if args.first.is_a?(Record)
args.first
else
Record.new(*args)
end
report.records << record
end
|
#conversion_target? ⇒ Boolean
169
170
171
|
# File 'lib/transpec/syntax.rb', line 169
def conversion_target?
dynamic_analysis_target?
end
|
#dependent_syntaxes ⇒ Object
173
174
175
|
# File 'lib/transpec/syntax.rb', line 173
def dependent_syntaxes
@dependent_syntaxes ||= []
end
|
#dynamic_analysis_target? ⇒ Boolean
165
166
167
|
# File 'lib/transpec/syntax.rb', line 165
def dynamic_analysis_target?
false
end
|
#expression_range ⇒ Object
185
186
187
|
# File 'lib/transpec/syntax.rb', line 185
def expression_range
node.loc.expression
end
|
#inspect ⇒ Object
189
190
191
|
# File 'lib/transpec/syntax.rb', line 189
def inspect
"#<#{self.class}: #{node.type}>"
end
|
#parent_node ⇒ Object
181
182
183
|
# File 'lib/transpec/syntax.rb', line 181
def parent_node
node.parent
end
|
#static_context_inspector ⇒ Object
177
178
179
|
# File 'lib/transpec/syntax.rb', line 177
def static_context_inspector
@static_context_inspector ||= StaticContextInspector.new(node)
end
|