Class: Nanoc2::AssetRepProxy
- Defined in:
- lib/nanoc2/base/proxies/asset_rep_proxy.rb
Overview
Nanoc2::AssetRepProxy is a proxy object for an asset representation (Nanoc2::AssetRep).
Instance Method Summary collapse
-
#[](key) ⇒ Object
Requests the asset representation attribute with the given name.
Methods inherited from Proxy
#[]=, #initialize, #method_missing
Constructor Details
This class inherits a constructor from Nanoc2::Proxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Nanoc2::Proxy
Instance Method Details
#[](key) ⇒ Object
Requests the asset representation attribute with the given name. key
can be a string or a symbol, and it can contain a trailing question mark (which will be stripped).
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nanoc2/base/proxies/asset_rep_proxy.rb', line 10 def [](key) real_key = key.to_s.sub(/\?$/, '').to_sym if real_key == :name @obj.name elsif real_key == :path @obj.web_path elsif real_key == :asset @obj.asset.to_proxy else super(key) end end |