Sha256: d9f02d6e90639561b527de91be70a7b6844f5a42ba3ab5d57c3c0cc520e5e3dc

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

module Orthor
  class Object
    include Orthor::HttpCaching
    include Orthor::MetaData

    attr_accessor :path
    dsl_accessor :id, :view, :template, :name

    def initialize(path, options = {})
      @path = path
      raise ArgumentError, "Path required" unless @path

      options.each { |key, val| send(key, val) }
      @id ||= @path.split("/").last
      @template ||= Orthor::Site.current_template
    end

    def content
      fetch_content
    end

    def path_name
      @id.gsub(/[^a-z0-9]+/i, '_')
    end

    def fetch_content
      raise "This must be overriden in any Orthor::Object subclass"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
orthorings-0.4.0 lib/orthor/object.rb