class Yarrow::Web::BaseDocument

Public Instance Methods

body() click to toggle source
# File lib/yarrow/web/document.rb, line 52
def body
  return @resource.body.to_html if @resource.respond_to?(:body)
  ""
end
breadcrumbs() click to toggle source

TODO: manage behaviour with and without current item TODO: link to manifest

TODO: replace @item and @collection with @node internally and in class interface

index() click to toggle source

TODO: confirm this can be deleted

# File lib/yarrow/web/document.rb, line 13
def index
  _index = @item.out_e(:index)
  unless _index.first.nil?
    _index.first.to.props
  else
    nil
  end
end
index_body() click to toggle source

TODO: confirm this can be deleted

# File lib/yarrow/web/document.rb, line 23
def index_body
  @item.props[:index_body]
end
name() click to toggle source
# File lib/yarrow/web/document.rb, line 44
def name
  @resource.name
end
resource() click to toggle source
# File lib/yarrow/web/document.rb, line 4
def resource
  @resource
end
title() click to toggle source
# File lib/yarrow/web/document.rb, line 48
def title
  @resource.title
end
type() click to toggle source
# File lib/yarrow/web/document.rb, line 8
def type
  @type
end
url() click to toggle source
# File lib/yarrow/web/document.rb, line 57
def url
  if @parent.nil?
    "/"
  else
    segments = [@resource.name]
    current = @parent

    until current.in(:collection).first.nil? do
      segments << current.props[:resource].name
      current = current.in(:collection).first
    end

    suffix = @is_index ? "/" : ""

    "/" + segments.reverse.join("/") + suffix
  end
end