Sha256: 2bf97eb8ecd8b018bd49de5033c97b114b71d9f2195e54872a745c541bf6e5c8

Contents?: true

Size: 865 Bytes

Versions: 6

Compression:

Stored size: 865 Bytes

Contents

# encoding: UTF-8

module Spontaneous
  class Layout < Style
    def try_paths
      [["layouts", prototype.name.to_s]]
    end

    class Default < Layout
      # If no named layouts have been defined first look for a layout
      # matching the class of our owner, then default to the 'standard'
      # layout.
      def try_paths
        named_layout = to_directory_name(owner)
        [["layouts", named_layout], ["layouts", "standard"]]
      end
    end

    class Anonymous
      def initialize(templates = {})
        @templates = templates
      end

      def template(format = :html, renderer)
        template = @templates[format]
        # a layout without a format is used as a fallback
        template ||= @templates[nil]
        template
      end

      def name
        nil
      end

      def schema_id
        nil
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/layout.rb
spontaneous-0.2.0.beta9 lib/spontaneous/layout.rb
spontaneous-0.2.0.beta8 lib/spontaneous/layout.rb
spontaneous-0.2.0.beta7 lib/spontaneous/layout.rb
spontaneous-0.2.0.beta6 lib/spontaneous/layout.rb
spontaneous-0.2.0.beta5 lib/spontaneous/layout.rb