module Transpec::Syntax::Mixin::AnyInstanceBlock
Public Instance Methods
add_receiver_arg_to_any_instance_implementation_block!()
click to toggle source
# File lib/transpec/syntax/mixin/any_instance_block.rb, line 21 def add_receiver_arg_to_any_instance_implementation_block! return unless need_to_add_receiver_arg_to_any_instance_implementation_block? insert_before(any_instance_block_first_arg_node.loc.expression, 'instance, ') true end
need_to_add_receiver_arg_to_any_instance_implementation_block?()
click to toggle source
# File lib/transpec/syntax/mixin/any_instance_block.rb, line 14 def need_to_add_receiver_arg_to_any_instance_implementation_block? first_arg_node = any_instance_block_first_arg_node return false unless first_arg_node first_arg_name = first_arg_node.children.first first_arg_name != :instance end
Private Instance Methods
any_instance_block_first_arg_node()
click to toggle source
# File lib/transpec/syntax/mixin/any_instance_block.rb, line 29 def any_instance_block_first_arg_node return nil unless any_instance_block_node any_instance_block_node.children[1].children[0] end
any_instance_block_node()
click to toggle source
# File lib/transpec/syntax/mixin/any_instance_block.rb, line 34 def any_instance_block_node return unless any_instance? Util.each_backward_chained_node(node).find(&:block_type?) end