Class: TarvitHelpers::HashPresenter::Cached

Inherits:
Simple
  • Object
show all
Defined in:
lib/tarvit-helpers/modules/hash_presenter/cached.rb

Direct Known Subclasses

WithRules

Instance Attribute Summary

Attributes inherited from Simple

#_hash, #_levels, #_parent

Instance Method Summary collapse

Methods inherited from Simple

#_root?, #method_missing

Constructor Details

#initialize(hash, levels = [], parent = nil) ⇒ Cached

Returns a new instance of Cached.



4
5
6
7
# File 'lib/tarvit-helpers/modules/hash_presenter/cached.rb', line 4

def initialize(hash, levels=[], parent=nil)
  super
  @cache = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TarvitHelpers::HashPresenter::Simple

Instance Method Details

#_value(method_name) ⇒ Object



9
10
11
# File 'lib/tarvit-helpers/modules/hash_presenter/cached.rb', line 9

def _value(method_name)
  @cache[method_name] ||= super
end