Sha256: b317b38e3b4e33655e3a1f2c2b47bc4a240f2a2895bf6aeb8060c1197715c9f4

Contents?: true

Size: 594 Bytes

Versions: 8

Compression:

Stored size: 594 Bytes

Contents

module Siteleaf
  class Content < Entity

    attr_accessor :title, :body, :path, :permalink, :visibility, :date, :user_id, :site_id, :metadata
    attr_reader :id, :filename, :basename, :directory, :url, :sha, :created_at, :updated_at

    def site
      Site.find(site_id) if site_id
    end

    def draft?
      visibility == 'draft'
    end

    def hidden?
      visibility == 'hidden'
    end

    def visible?
      visibility == 'visible'
    end
    alias_method :published?, :visible?

    def to_file
      SourceFile.new(site_id: site_id, name: filename).to_file
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
siteleaf-2.3.0 lib/siteleaf/content.rb
siteleaf-2.2.1 lib/siteleaf/content.rb
siteleaf-2.2.0 lib/siteleaf/content.rb
siteleaf-2.1.2 lib/siteleaf/content.rb
siteleaf-2.1.1 lib/siteleaf/content.rb
siteleaf-2.1.0 lib/siteleaf/content.rb
siteleaf-2.0.2 lib/siteleaf/content.rb
siteleaf-2.0.1 lib/siteleaf/content.rb