Class: I18n::Backend::KeyValue::SubtreeProxy
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #has_key?(key) ⇒ Boolean
-
#initialize(master_key, store) ⇒ SubtreeProxy
constructor
A new instance of SubtreeProxy.
- #inspect ⇒ Object
- #instance_of?(klass) ⇒ Boolean
- #is_a?(klass) ⇒ Boolean (also: #kind_of?)
- #nil? ⇒ Boolean
Constructor Details
#initialize(master_key, store) ⇒ SubtreeProxy
Returns a new instance of SubtreeProxy.
162 163 164 165 166 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb', line 162 def initialize(master_key, store) @master_key = master_key @store = store @subtree = nil end |
Instance Method Details
#[](key) ⇒ Object
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb', line 172 def [](key) unless @subtree && value = @subtree[key] value = @store["#{@master_key}.#{key}"] if value value = JSON.decode(value) (@subtree ||= {})[key] = value end end value end |
#has_key?(key) ⇒ Boolean
168 169 170 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb', line 168 def has_key?(key) @subtree && @subtree.has_key?(key) || self[key] end |
#inspect ⇒ Object
196 197 198 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb', line 196 def inspect @subtree.inspect end |
#instance_of?(klass) ⇒ Boolean
188 189 190 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb', line 188 def instance_of?(klass) Hash == klass || super end |
#is_a?(klass) ⇒ Boolean Also known as: kind_of?
183 184 185 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb', line 183 def is_a?(klass) Hash == klass || super end |
#nil? ⇒ Boolean
192 193 194 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/key_value.rb', line 192 def nil? @subtree.nil? end |