Class: Transpec::Syntax::Receive
- Inherits:
-
Transpec::Syntax
- Object
- Transpec::Syntax
- Transpec::Syntax::Receive
- Includes:
- Mixin::MessagingHost, Mixin::OwnedMatcher, Mixin::Send
- Defined in:
- lib/transpec/syntax/receive.rb
Defined Under Namespace
Classes: ReceiveAnyInstanceBlockRecord, ReceiveUselessAndReturnRecord
Instance Attribute Summary
Attributes inherited from Transpec::Syntax
#node, #report, #runtime_data, #source_rewriter
Class Method Summary collapse
Instance Method Summary collapse
- #add_receiver_arg_to_any_instance_implementation_block! ⇒ Object
- #any_instance? ⇒ Boolean
- #any_instance_block_node ⇒ Object
- #remove_useless_and_return! ⇒ Object
Methods included from Mixin::Send
#arg_node, #arg_nodes, #arg_range, #args_range, #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 Mixin::OwnedMatcher
Methods included from Mixin::NoMessageAllowance
#allow_no_message?, #any_number_of_times?, #at_least_zero?, #remove_no_message_allowance!
Methods included from Mixin::UselessAndReturn
#and_return?, #and_return_node, #and_return_with_block?, #useless_and_return?
Methods inherited from Transpec::Syntax
conversion_target_node?, #expression_range, #initialize, #parent_node, snake_case_name, standalone?, #static_context_inspector, target_node?
Methods included from Collection
#all_syntaxes, #inherited, #require_all, #standalone_syntaxes
Methods included from DynamicAnalysis
#register_request_for_dynamic_analysis
Class Method Details
.target_method?(receiver_node, method_name) ⇒ Boolean
13 14 15 |
# File 'lib/transpec/syntax/receive.rb', line 13 def self.target_method?(receiver_node, method_name) receiver_node.nil? && method_name == :receive end |
Instance Method Details
#add_receiver_arg_to_any_instance_implementation_block! ⇒ Object
23 24 25 26 27 |
# File 'lib/transpec/syntax/receive.rb', line 23 def add_receiver_arg_to_any_instance_implementation_block! added = super return unless added @report.records << ReceiveAnyInstanceBlockRecord.new(self) end |
#any_instance? ⇒ Boolean
29 30 31 |
# File 'lib/transpec/syntax/receive.rb', line 29 def any_instance? @expectation.any_instance? end |
#any_instance_block_node ⇒ Object
33 34 35 36 |
# File 'lib/transpec/syntax/receive.rb', line 33 def any_instance_block_node return unless any_instance? super || @expectation.block_node end |
#remove_useless_and_return! ⇒ Object
17 18 19 20 21 |
# File 'lib/transpec/syntax/receive.rb', line 17 def remove_useless_and_return! removed = super return unless removed @report.records << ReceiveUselessAndReturnRecord.new(self) end |