Class: Mobility::Backends::Sequel::Json

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

Defined Under Namespace

Classes: JSONOp

Backend Accessors collapse

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::Json::JSONOp

Parameters:

  • name (Symbol)

    Attribute name

  • locale (Symbol)

    Locale

Returns:



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

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

Instance Method Details

#read(locale, options = {}) ⇒ String, ...

Note:

Translation may be any json type, but querying will only work on string-typed values.

Returns Value of translation.

Parameters:

  • locale (Symbol)

    Locale to read

  • options (Hash) (defaults to: {})

Returns:

  • (String, Integer, Boolean)

    Value of translation



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

#write(locale, value, options = {}) ⇒ String, ...

Note:

Translation may be any json type, but querying will only work on string-typed values.

Returns Updated value.

Parameters:

  • locale (Symbol)

    Locale to write

  • value (String, Integer, Boolean)

    Value to write

  • options (Hash) (defaults to: {})

Returns:

  • (String, Integer, Boolean)

    Updated value



# File 'lib/mobility/backends/sequel/json.rb', line 26