Sha256: 0d166c922791ba0a2f30ef99688762bd7ce7b087e59fd891ea6bf68cc23a037d

Contents?: true

Size: 624 Bytes

Versions: 5

Compression:

Stored size: 624 Bytes

Contents

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

    attr_accessor :path
    dsl_accessor :name, :id

    def initialize(path, object_name = nil, &block)
      @path = path
      raise "Path required" unless @path
      @id = @path.split("/").last # by default, can be passed in
      name(object_name)

      instance_eval &block if block_given?
    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

5 entries across 5 versions & 1 rubygems

Version Path
orthorings-0.1.4 lib/orthor/object.rb
orthorings-0.1.3 lib/orthor/object.rb
orthorings-0.1.2 lib/orthor/object.rb
orthorings-0.1.1 lib/orthor/object.rb
orthorings-0.1.0 lib/orthor/object.rb