Class: Proteus::PropertyHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/PropertyHash.rb

Overview

Wraps the properties of an instance used in the InstanceProxy, rendering its values before returning them.

Instance Method Summary collapse

Constructor Details

#initialize(properties, renderer) ⇒ PropertyHash


Constructor



39
40
41
42
# File 'lib/PropertyHash.rb', line 39

def initialize( properties, renderer )
  super( properties )
  @renderer = renderer
end

Instance Method Details

#[](val) ⇒ Object

Overrides the default [] operator to render values before they’re returned.



56
57
58
59
# File 'lib/PropertyHash.rb', line 56

def []( val )
  result = super[val]
  return @renderer.render( result )
end