Sha256: 377ab976c770182b9a97733062ddd90ed37ab5a0099963590e8a0ebf61e50af2
Contents?: true
Size: 747 Bytes
Versions: 1
Compression:
Stored size: 747 Bytes
Contents
module Nanoc2 # Nanoc2::AssetProxy is a proxy object for an asset (Nanoc2::Asset). class AssetProxy < Proxy # Requests the asset 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). def [](key) real_key = key.to_s.sub(/\?$/, '').to_sym if real_key == :mtime @obj.mtime elsif real_key == :path # backward compatibility @obj.reps.find { |r| r.name == :default }.web_path else super(key) end end # Returns the asset representation with the given name. def reps(name) rep = @obj.reps.find { |r| r.name == name } rep.nil? ? nil : rep.to_proxy end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nanoc2-2.2.3 | lib/nanoc2/base/proxies/asset_proxy.rb |