Class: PgExecArrayParams::Rewriters::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_exec_array_params/rewriters/node.rb

Direct Known Subclasses

AExpr, ResTarget

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, ref_idx) ⇒ Node

Returns a new instance of Node.



8
9
10
11
# File 'lib/pg_exec_array_params/rewriters/node.rb', line 8

def initialize(value, ref_idx)
  @value = value
  @ref_idx = ref_idx
end

Instance Attribute Details

#ref_idxObject (readonly)

Returns the value of attribute ref_idx.



6
7
8
# File 'lib/pg_exec_array_params/rewriters/node.rb', line 6

def ref_idx
  @ref_idx
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/pg_exec_array_params/rewriters/node.rb', line 6

def value
  @value
end

Instance Method Details

#processObject



13
14
15
# File 'lib/pg_exec_array_params/rewriters/node.rb', line 13

def process
  rewrite! if should_rewrite?
end

#to_sObject

used in exception rendering



18
19
20
21
22
# File 'lib/pg_exec_array_params/rewriters/node.rb', line 18

def to_s
  return '<unknown node position>' unless (from, size = refs_at)

  "#{'^'.rjust(from, ' ')}#{'-'.rjust(size, '-')}^"
end