Sha256: 313e9ecf595689f21ca553f455de653ac4840b683124765bd081284f9ba92658
Contents?: true
Size: 744 Bytes
Versions: 10
Compression:
Stored size: 744 Bytes
Contents
module Nanoc # Nanoc::AssetProxy is a proxy object for an asset (Nanoc::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
10 entries across 10 versions & 1 rubygems