Class: Mobility::Backends::Sequel::Jsonb::JSONBOp

Inherits:
Sequel::Postgres::JSONBOp
  • Object
show all
Defined in:
lib/mobility/backends/sequel/jsonb.rb

Direct Known Subclasses

Container::JSONBOp

Instance Method Summary collapse

Instance Method Details

#=~(other) ⇒ Object


56
57
58
59
60
61
62
63
64
65
# File 'lib/mobility/backends/sequel/jsonb.rb', line 56

def =~(other)
  case other
  when Integer, Hash
    to_dash_arrow =~ other.to_json
  when NilClass
    ~to_question
  else
    super
  end
end

#to_dash_arrowObject


44
45
46
47
48
# File 'lib/mobility/backends/sequel/jsonb.rb', line 44

def to_dash_arrow
  column = @value.args[0].value
  locale = @value.args[1]
  ::Sequel.pg_jsonb_op(column)[locale]
end

#to_questionObject


50
51
52
53
54
# File 'lib/mobility/backends/sequel/jsonb.rb', line 50

def to_question
  column = @value.args[0].value
  locale = @value.args[1]
  ::Sequel.pg_jsonb_op(column).has_key?(locale)
end