Class: RuboCop::AST::SendNode

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/ast/send_node.rb

Overview

Spanner-specific extensions for RuboCop::AST::SendNode objects

Instance Method Summary collapse

Instance Method Details

#create_table?Boolean

Returns:



17
18
19
# File 'lib/rubocop/ast/send_node.rb', line 17

def create_table?
  method_name == :create_table
end

#find_hash_option(option_name) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/rubocop/ast/send_node.rb', line 21

def find_hash_option(option_name)
  return unless arguments.last.hash_type?

  option_name = option_name.to_sym
  arguments.last.children.find do |c|
    c.pair_type? && c.children[0].sym_type? && c.children[0].children[0] == option_name
  end
end

#find_hash_option_source(option_name) ⇒ Object



30
31
32
# File 'lib/rubocop/ast/send_node.rb', line 30

def find_hash_option_source(option_name)
  find_hash_option(option_name.to_sym)&.source
end

#last_siblingObject



44
45
46
# File 'lib/rubocop/ast/send_node.rb', line 44

def last_sibling
  parent.children.last
end

#sending_t?Boolean

Returns:



13
14
15
# File 'lib/rubocop/ast/send_node.rb', line 13

def sending_t?
  receiver && receiver.source == "t"
end