class Prismic::Fragments::DocumentLink
Attributes
broken[RW]
broken?[RW]
fragments[RW]
id[RW]
lang[RW]
slug[RW]
target[RW]
type[RW]
uid[RW]
Public Class Methods
new(id, uid, type, tags, slug, lang, fragments, broken, target = nil)
click to toggle source
# File lib/prismic/fragments/link.rb, line 112 def initialize(id, uid, type, tags, slug, lang, fragments, broken, target = nil) @id = id @uid = uid @type = type @tags = tags @slug = slug @lang = lang @fragments = fragments @broken = broken @target = target end
Public Instance Methods
as_html(link_resolver=nil)
click to toggle source
# File lib/prismic/fragments/link.rb, line 132 def as_html(link_resolver=nil) %(#{start_html(link_resolver)}#{slug}#{end_html}) end
end_html()
click to toggle source
Calls superclass method
Prismic::Fragments::Link#end_html
# File lib/prismic/fragments/link.rb, line 128 def end_html broken? ? %(</span>) : super end
link_type()
click to toggle source
# File lib/prismic/fragments/link.rb, line 136 def link_type warn('WARNING: DocumentLink.link_type is deprecated, use DocumentLink.type instead') self.type end
start_html(link_resolver, target = nil)
click to toggle source
Calls superclass method
Prismic::Fragments::Link#start_html
# File lib/prismic/fragments/link.rb, line 124 def start_html(link_resolver, target = nil) broken? ? %(<span>) : super end
url(link_resolver = nil)
click to toggle source
Returns the URL of the link
@overload url(link_resolver)
@see Link#url
@param link_resolver [LinkResolver]
# File lib/prismic/fragments/link.rb, line 148 def url(link_resolver = nil) raise "A link_resolver method is needed to serialize document links into a correct URL on your website. If you're using a starter kit, a trivial one is provided out-of-the-box, that you can update later." if link_resolver == nil link_resolver.link_to(self) end