Class: I18nAdmin::Translation

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/i18n_admin/translation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/i18n_admin/translation.rb', line 7

def key
  @key
end

#localeObject

Returns the value of attribute locale.



7
8
9
# File 'lib/i18n_admin/translation.rb', line 7

def locale
  @locale
end

#originalObject

Returns the value of attribute original.



7
8
9
# File 'lib/i18n_admin/translation.rb', line 7

def original
  @original
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/i18n_admin/translation.rb', line 7

def value
  @value
end

Class Method Details

.key_from(encoded_key) ⇒ Object



23
24
25
# File 'lib/i18n_admin/translation.rb', line 23

def self.key_from(encoded_key)
  Base64.decode64(encoded_key)
end

Instance Method Details

#matches?(search) ⇒ Boolean



17
18
19
20
21
# File 'lib/i18n_admin/translation.rb', line 17

def matches?(search)
  [:key, :original, :value].any? do |key|
    send(key).to_s.match(search)
  end
end

#persisted?Boolean



9
10
11
# File 'lib/i18n_admin/translation.rb', line 9

def persisted?
  true
end

#to_paramObject



13
14
15
# File 'lib/i18n_admin/translation.rb', line 13

def to_param
  Base64.strict_encode64(key)
end