Sha256: 3507607bc7230c0de574c90b85669d546cd1bb7ac9e6b63a39eae24e3f325d7a

Contents?: true

Size: 565 Bytes

Versions: 1

Compression:

Stored size: 565 Bytes

Contents

module Nanoc2

  # Nanoc2::LayoutProxy is a proxy object for a layout (Nanoc2::Layout).
  class LayoutProxy < Proxy

    # Requests the layout 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 == :content
        @obj.content
      elsif real_key == :path
        @obj.path
      elsif real_key == :mtime
        @obj.mtime
      else
        super(key)
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc2-2.2.3 lib/nanoc2/base/proxies/layout_proxy.rb