Class: Transpec::Syntax::Its
- Inherits:
-
Transpec::Syntax
- Object
- Transpec::Syntax
- Transpec::Syntax::Its
- Includes:
- Mixin::Send, Util
- Defined in:
- lib/transpec/syntax/its.rb
Defined Under Namespace
Classes: Attribute, AttributeExpression
Constant Summary
Constants included from Util
Instance Attribute Summary
Attributes inherited from Transpec::Syntax
#node, #report, #runtime_data, #source_rewriter
Class Method Summary collapse
Instance Method Summary collapse
- #attribute_expression ⇒ Object
- #attributes ⇒ Object
- #block_node ⇒ Object
- #convert_to_describe_subject_it! ⇒ Object
Methods included from Mixin::Send
#arg_node, #arg_nodes, #arg_range, included, #method_name, #parentheses_range, #range_after_arg, #range_in_between_receiver_and_selector, #range_in_between_selector_and_arg, #receiver_node, #receiver_range, #selector_range
Methods included from Util
const_name, contain_here_document?, here_document?, in_parentheses?, indentation_of_line, literal?, proc_literal?
Methods inherited from Transpec::Syntax
all_syntaxes, #expression_range, inherited, #initialize, #parent_node, #register_request_for_dynamic_analysis, register_request_for_dynamic_analysis, snake_case_name, standalone?, standalone_syntaxes, #static_context_inspector, target_node?
Constructor Details
This class inherits a constructor from Transpec::Syntax
Class Method Details
.target_method?(receiver_node, method_name) ⇒ Boolean
12 13 14 |
# File 'lib/transpec/syntax/its.rb', line 12 def self.target_method?(receiver_node, method_name) receiver_node.nil? && method_name == :its end |
Instance Method Details
#attribute_expression ⇒ Object
26 27 28 |
# File 'lib/transpec/syntax/its.rb', line 26 def attribute_expression @attribute_expression ||= AttributeExpression.new(attribute_node) end |
#attributes ⇒ Object
30 31 32 |
# File 'lib/transpec/syntax/its.rb', line 30 def attributes attribute_expression.attributes end |
#block_node ⇒ Object
36 37 38 |
# File 'lib/transpec/syntax/its.rb', line 36 def block_node @node.parent_node end |
#convert_to_describe_subject_it! ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/transpec/syntax/its.rb', line 16 def convert_to_describe_subject_it! front, rear = build_wrapper_codes insert_before(beginning_of_line_range, front) replace(expression_range, 'it') insert_after(block_node.loc.expression, rear) register_record end |