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

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

Defined Under Namespace

Classes: JSONBOp

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mobility::Backends::Sequel

included

Class Method Details

.build_op(attr, locale) ⇒ Mobility::Backends::Sequel::Jsonb::JSONBOp

Parameters:

  • name (Symbol)

    Attribute name

  • locale (Symbol)

    Locale

Returns:



38
39
40
41
# File 'lib/mobility/backends/sequel/jsonb.rb', line 38

def self.build_op(attr, locale)
  column_name = column_affix % attr
  JSONBOp.new(column_name.to_sym).get_text(locale.to_s)
end

Instance Method Details

#read(locale, **options) ⇒ String, ...

Note:

Translation may be string, integer or boolean-valued since value is stored on a JSON hash.

Returns Value of translation.

Parameters:

  • locale (Symbol)

    Locale to read

  • options (Hash)

Returns:

  • (String, Integer, Boolean)

    Value of translation



# File 'lib/mobility/backends/sequel/jsonb.rb', line 17

#write(locale, value, **options) ⇒ String, ...

Note:

Translation may be string, integer or boolean-valued since value is stored on a JSON hash.

Returns Updated value.

Parameters:

  • locale (Symbol)

    Locale to write

  • value (String, Integer, Boolean)

    Value to write

  • options (Hash)

Returns:

  • (String, Integer, Boolean)

    Updated value



# File 'lib/mobility/backends/sequel/jsonb.rb', line 17