File: //usr/local/rvm/gems/default/doc/i18n-1.8.11/ri/I18n/Backend/KeyValue/cdesc-KeyValue.ri
U:RDoc::NormalClass[iI"
KeyValue:ETI"I18n::Backend::KeyValue;TI"Object;To:RDoc::Markup::Document:@parts[o;;[ o:RDoc::Markup::Paragraph;[I"BThis is a basic backend for key value stores. It receives on ;TI"Einitialization the store, which should respond to three methods:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"0store#[](key) - Used to get a value;To;;0;[o; ;[I"0store#[]=(key, value) - Used to set a value;To;;0;[o; ;[I"1store#keys - Used to get all keys;T@o; ;[I"GSince these stores only supports string, all values are converted ;TI"Fto JSON before being stored, allowing it to also store booleans, ;TI"Chashes and arrays. However, this store does not support Procs.;T@o; ;[I"JAs the ActiveRecord backend, Symbols are just supported when loading ;TI"Mtranslations from the filesystem or through explicit store translations.;T@o; ;[I"EAlso, avoid calling I18n.available_locales since it's a somehow ;TI"(expensive operation in most stores.;T@S:RDoc::Markup::Heading:
leveli: textI"Example;T@o; ;[I"JTo setup I18n to use TokyoCabinet in memory is quite straightforward:;T@o:RDoc::Markup::Verbatim;[I"=require 'rufus/tokyo/cabinet' # gem install rufus-tokyo
;TI"PI18n.backend = I18n::Backend::KeyValue.new(Rufus::Tokyo::Cabinet.new('*'))
;T:@format0S;;i;I"Performance;T@o; ;[I"LYou may make this backend even faster by including the Memoize module. ;TI"LHowever, notice that you should properly clear the cache if you change ;TI"&values directly in the key-store.;T@S;;i;I"
Subtrees;T@o; ;[I"NIn most backends, you are allowed to retrieve part of a translation tree:;T@o;;[I"CI18n.backend.store_translations :en, :foo => { :bar => :baz }
;TI"'I18n.t "foo" #=> { :bar => :baz }
;T;0o; ;[I"RThis backend supports this feature by default, but it slows down the storage ;TI"Sof new data considerably and makes hard to delete entries. That said, you are ;TI"Ballowed to disable the storage of subtrees on initialization:;T@o;;[I"0I18n::Backend::KeyValue.new(@store, false)
;T;0o; ;[I"TThis is useful if you are using a KeyValue backend chained to a Simple backend.;T:
@fileI""lib/i18n/backend/key_value.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [[I"Implementation;To;;[ ;@U;0I""lib/i18n/backend/key_value.rb;T[[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[ [;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@UI"I18n::Backend;TcRDoc::NormalModule