Class: Mobility::Backends::Sequel::Hstore

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

Defined Under Namespace

Classes: HStoreOp

Backend Accessors collapse

Class Method Summary collapse

Methods included from Mobility::Backends::Sequel

included

Class Method Details

.build_op(attr, locale) ⇒ Mobility::Backends::Sequel::Hstore::HStoreOp

Parameters:

  • name (Symbol)

    Attribute name

  • locale (Symbol)

    Locale

Returns:



30
31
32
33
# File 'lib/mobility/backends/sequel/hstore.rb', line 30

def self.build_op(attr, locale)
  column_name = column_affix % attr
  HStoreOp.new(column_name.to_sym)[locale.to_s]
end

Instance Method Details

#read(locale, options = {}) ⇒ Object

Gets the translated value for provided locale from configured backend.

Parameters:

  • locale (Symbol)

    Locale to read

Returns:

  • (Object)

    Value of translation



# File 'lib/mobility/backends/sequel/hstore.rb', line 16

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

Updates translation for provided locale without calling backend’s methods to persist the changes.

Parameters:

  • locale (Symbol)

    Locale to write

  • value (Object)

    Value to write

Returns:

  • (Object)

    Updated value



22
23
24
# File 'lib/mobility/backends/sequel/hstore.rb', line 22

def write(locale, value, options = {})
  super(locale, value && value.to_s, **options)
end