Class: AssociateJsonb::ArelNodes::Jsonb::Operator

Inherits:
Arel::Nodes::InfixOperation
  • Object
show all
Defined in:
lib/associate_jsonb/arel_nodes/jsonb/operator.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation, left_side, key) ⇒ Operator

Returns a new instance of Operator.



8
9
10
11
12
13
# File 'lib/associate_jsonb/arel_nodes/jsonb/operator.rb', line 8

def initialize(relation, left_side, key)
  @relation = relation
  @name = key

  super(operator, left_side, right_side)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/associate_jsonb/arel_nodes/jsonb/operator.rb', line 6

def name
  @name
end

#relationObject (readonly)

Returns the value of attribute relation.



5
6
7
# File 'lib/associate_jsonb/arel_nodes/jsonb/operator.rb', line 5

def relation
  @relation
end

Instance Method Details

#operatorObject

Raises:

  • (NotImplementedError)


19
20
21
22
# File 'lib/associate_jsonb/arel_nodes/jsonb/operator.rb', line 19

def operator
  raise NotImplementedError,
        'Subclasses must implement an #operator method'
end

#right_sideObject



15
16
17
# File 'lib/associate_jsonb/arel_nodes/jsonb/operator.rb', line 15

def right_side
  ::Arel::Nodes::SqlLiteral.new("'#{name}'")
end