Class: Transpec::Syntax
- Inherits:
-
Object
- Object
- Transpec::Syntax
- 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/its.rb,
lib/transpec/syntax/have.rb,
lib/transpec/syntax/double.rb,
lib/transpec/syntax/expect.rb,
lib/transpec/syntax/should.rb,
lib/transpec/syntax/example.rb,
lib/transpec/syntax/be_close.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/should_receive.rb,
lib/transpec/syntax/oneliner_should.rb,
lib/transpec/syntax/rspec_configure.rb,
lib/transpec/syntax/operator_matcher.rb,
lib/transpec/syntax/mixin/should_base.rb,
lib/transpec/syntax/matcher_definition.rb,
lib/transpec/syntax/mixin/any_instance.rb,
lib/transpec/syntax/mixin/expectizable.rb,
lib/transpec/syntax/mixin/monkey_patch.rb,
lib/transpec/syntax/mixin/allow_no_message.rb,
lib/transpec/syntax/mixin/have_matcher_owner.rb
Direct Known Subclasses
BeBoolean, BeClose, Double, Example, Expect, Have, Its, MatcherDefinition, MethodStub, OnelinerShould, OperatorMatcher, RSpecConfigure, RaiseError, Should, ShouldReceive
Defined Under Namespace
Modules: Collection, DynamicAnalysis, Mixin, Rewritable Classes: BeBoolean, BeClose, Double, Example, Expect, Have, Its, MatcherDefinition, MethodStub, OnelinerShould, OperatorMatcher, RSpecConfigure, RaiseError, Should, ShouldReceive
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
-
#runtime_data ⇒ Object
readonly
Returns the value of attribute runtime_data.
-
#source_rewriter ⇒ Object
readonly
Returns the value of attribute source_rewriter.
Class Method Summary collapse
- .conversion_target_node?(node, runtime_data = nil) ⇒ Boolean
- .snake_case_name ⇒ Object
- .standalone? ⇒ Boolean
-
.target_node?(node, runtime_data = nil) ⇒ Boolean
The default common method for .conversion_target_node? and .dynamic_analysis_target_node?.
Instance Method Summary collapse
- #expression_range ⇒ Object
-
#initialize(node, source_rewriter = nil, runtime_data = nil, report = nil) ⇒ Syntax
constructor
A new instance of Syntax.
- #parent_node ⇒ Object
- #static_context_inspector ⇒ Object
Methods included from Collection
all_syntaxes, inherited, require_all, standalone_syntaxes
Methods included from DynamicAnalysis
#register_request_for_dynamic_analysis
Constructor Details
#initialize(node, source_rewriter = nil, runtime_data = nil, report = nil) ⇒ Syntax
Returns a new instance of Syntax.
114 115 116 117 118 119 |
# File 'lib/transpec/syntax.rb', line 114 def initialize(node, source_rewriter = nil, runtime_data = nil, report = nil) @node = node @source_rewriter = source_rewriter @runtime_data = runtime_data @report = report || Report.new end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
91 92 93 |
# File 'lib/transpec/syntax.rb', line 91 def node @node end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
91 92 93 |
# File 'lib/transpec/syntax.rb', line 91 def report @report end |
#runtime_data ⇒ Object (readonly)
Returns the value of attribute runtime_data.
91 92 93 |
# File 'lib/transpec/syntax.rb', line 91 def runtime_data @runtime_data end |
#source_rewriter ⇒ Object (readonly)
Returns the value of attribute source_rewriter.
91 92 93 |
# File 'lib/transpec/syntax.rb', line 91 def source_rewriter @source_rewriter end |
Class Method Details
.conversion_target_node?(node, runtime_data = nil) ⇒ Boolean
110 111 112 |
# File 'lib/transpec/syntax.rb', line 110 def self.conversion_target_node?(node, runtime_data = nil) target_node?(node, runtime_data) end |
.snake_case_name ⇒ Object
97 98 99 100 101 102 |
# File 'lib/transpec/syntax.rb', line 97 def self.snake_case_name @snake_cake_name ||= begin class_name = name.split('::').last class_name.gsub(/([a-z])([A-Z])/, '\1_\2').downcase end end |
.standalone? ⇒ Boolean
93 94 95 |
# File 'lib/transpec/syntax.rb', line 93 def self.standalone? true end |
.target_node?(node, runtime_data = nil) ⇒ Boolean
The default common method for .conversion_target_node? and .dynamic_analysis_target_node?. If they should behave differently, override either or both.
106 107 108 |
# File 'lib/transpec/syntax.rb', line 106 def self.target_node?(node, runtime_data = nil) false end |
Instance Method Details
#expression_range ⇒ Object
129 130 131 |
# File 'lib/transpec/syntax.rb', line 129 def expression_range @node.loc.expression end |
#parent_node ⇒ Object
125 126 127 |
# File 'lib/transpec/syntax.rb', line 125 def parent_node @node.parent_node end |
#static_context_inspector ⇒ Object
121 122 123 |
# File 'lib/transpec/syntax.rb', line 121 def static_context_inspector @static_context_inspector ||= StaticContextInspector.new(@node) end |