Module: ROM::SQL::Postgres::Types::JSONMethods

Defined in:
lib/rom/sql/extensions/postgres/types/json.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](type, wrap) ⇒ Object



167
168
169
170
171
172
173
174
# File 'lib/rom/sql/extensions/postgres/types/json.rb', line 167

def self.[](type, wrap)
  parent = self
  Module.new do
    include parent
    define_method(:json_type) { type }
    define_method(:wrap, wrap)
  end
end

Instance Method Details

#get(type, expr, *path) ⇒ Object



176
177
178
# File 'lib/rom/sql/extensions/postgres/types/json.rb', line 176

def get(type, expr, *path)
  Attribute[json_type].meta(sql_expr: wrap(expr)[path_args(path)])
end

#get_text(type, expr, *path) ⇒ Object



180
181
182
# File 'lib/rom/sql/extensions/postgres/types/json.rb', line 180

def get_text(type, expr, *path)
  Attribute[SQL::Types::String].meta(sql_expr: wrap(expr).get_text(path_args(path)))
end