Module: Ruby::Merge::SignatureSupport

Defined in:
lib/ruby/merge/signature_support.rb

Overview

Stable structural signatures used by Ruby owner and method matching.

Class Method Summary collapse

Class Method Details

.begin_block(first_statement_preview) ⇒ Object



53
54
55
# File 'lib/ruby/merge/signature_support.rb', line 53

def begin_block(first_statement_preview)
  [:begin, first_statement_preview || '']
end

.call(method_name, identifier, block: false) ⇒ Object



57
58
59
# File 'lib/ruby/merge/signature_support.rb', line 57

def call(method_name, identifier, block: false)
  [block ? :call_with_block : :call, method_name, identifier]
end

.call_operator_write(write_name, receiver) ⇒ Object



69
70
71
# File 'lib/ruby/merge/signature_support.rb', line 69

def call_operator_write(write_name, receiver)
  [:call_op_write, write_name, receiver]
end

.case_match_statement(predicate) ⇒ Object



45
46
47
# File 'lib/ruby/merge/signature_support.rb', line 45

def case_match_statement(predicate)
  [:case_match, predicate || '']
end

.case_statement(predicate) ⇒ Object



41
42
43
# File 'lib/ruby/merge/signature_support.rb', line 41

def case_statement(predicate)
  [:case, predicate || '']
end

.class_definition(constant_path) ⇒ Object



13
14
15
# File 'lib/ruby/merge/signature_support.rb', line 13

def class_definition(constant_path)
  [:class, constant_path]
end

.conditional(kind, predicate) ⇒ Object



37
38
39
# File 'lib/ruby/merge/signature_support.rb', line 37

def conditional(kind, predicate)
  [kind, predicate]
end

.constant(name) ⇒ Object



25
26
27
# File 'lib/ruby/merge/signature_support.rb', line 25

def constant(name)
  [:const, name]
end

.embedded(statements_source) ⇒ Object



85
86
87
# File 'lib/ruby/merge/signature_support.rb', line 85

def embedded(statements_source)
  [:embedded, statements_source || '']
end

.execution_block(kind, line_number) ⇒ Object



77
78
79
# File 'lib/ruby/merge/signature_support.rb', line 77

def execution_block(kind, line_number)
  [kind, line_number]
end

.forwarding_super_call(block:) ⇒ Object



65
66
67
# File 'lib/ruby/merge/signature_support.rb', line 65

def forwarding_super_call(block:)
  [:forwarding_super, block ? :with_block : :no_block]
end

.lambda_literal(parameters_source) ⇒ Object



73
74
75
# File 'lib/ruby/merge/signature_support.rb', line 73

def lambda_literal(parameters_source)
  [:lambda, parameters_source || '']
end

.loop_statement(kind, *parts) ⇒ Object



49
50
51
# File 'lib/ruby/merge/signature_support.rb', line 49

def loop_statement(kind, *parts)
  [kind, *parts]
end

.method_definition(name, params) ⇒ Object



9
10
11
# File 'lib/ruby/merge/signature_support.rb', line 9

def method_definition(name, params)
  [:def, name, Array(params)]
end

.module_definition(constant_path) ⇒ Object



17
18
19
# File 'lib/ruby/merge/signature_support.rb', line 17

def module_definition(constant_path)
  [:module, constant_path]
end

.multi_write(targets) ⇒ Object



33
34
35
# File 'lib/ruby/merge/signature_support.rb', line 33

def multi_write(targets)
  [:multi_write, Array(targets)]
end

.other(class_name, line_number) ⇒ Object



89
90
91
# File 'lib/ruby/merge/signature_support.rb', line 89

def other(class_name, line_number)
  [:other, class_name, line_number]
end

.parenthesized(first_expression_preview) ⇒ Object



81
82
83
# File 'lib/ruby/merge/signature_support.rb', line 81

def parenthesized(first_expression_preview)
  [:parens, first_expression_preview || '']
end

.singleton_class(expression) ⇒ Object



21
22
23
# File 'lib/ruby/merge/signature_support.rb', line 21

def singleton_class(expression)
  [:singleton_class, expression]
end

.super_call(block:) ⇒ Object



61
62
63
# File 'lib/ruby/merge/signature_support.rb', line 61

def super_call(block:)
  [:super, block ? :with_block : :no_block]
end

.textual_method_signature(receiver_prefix, method_name) ⇒ Object



93
94
95
# File 'lib/ruby/merge/signature_support.rb', line 93

def textual_method_signature(receiver_prefix, method_name)
  "#{receiver_prefix}#{method_name}"
end

.variable_assignment(kind, name) ⇒ Object



29
30
31
# File 'lib/ruby/merge/signature_support.rb', line 29

def variable_assignment(kind, name)
  [kind, name]
end