Module: ROM::SQL::Types::PG::JSONMethods
- Defined in:
- lib/rom/sql/extensions/postgres/types.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.[](type, wrap) ⇒ Object
306 307 308 309 310 311 312 313 |
# File 'lib/rom/sql/extensions/postgres/types.rb', line 306 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
315 316 317 |
# File 'lib/rom/sql/extensions/postgres/types.rb', line 315 def get(type, expr, *path) Attribute[json_type].(sql_expr: wrap(expr)[path_args(path)]) end |
#get_text(type, expr, *path) ⇒ Object
319 320 321 |
# File 'lib/rom/sql/extensions/postgres/types.rb', line 319 def get_text(type, expr, *path) Attribute[Types::String].(sql_expr: wrap(expr).get_text(path_args(path))) end |