lib/scrivito/link.rb in scrivito_sdk-1.3.1 vs lib/scrivito/link.rb in scrivito_sdk-1.4.0.rc1
- old
+ new
@@ -1,9 +1,10 @@
require 'active_model/naming'
module Scrivito
- # This class provides an interface for handling CMS links.
+ # This class represents individual external or internal links Scrivito is able to identify and
+ # to process.
# To format a link for rendering on an HTML page, use the +scrivito_path+ or +scrivito_url+ methods.
# @api public
class Link
extend ActiveModel::Naming
@@ -31,11 +32,11 @@
# @option link_data [String] fragment
def initialize(link_data)
@link_data = link_data.with_indifferent_access
end
- # The external URL of the link. Only available for external links.
+ # The external URL of the link. Returns +nil+ if the link is internal.
# Warning: Do not output the URL directly unless you know what you are doing.
# Normally, you want to use the +scrivito_path+ or +scrivito_url+ methods to format a link.
# @api public
def url
@link_data[:url]
@@ -46,11 +47,10 @@
# @param value [String] the url of the link
def url=(value)
@link_data[:url] = value
end
- # Returns the {BasicObj Obj} this link references. May be +nil+ if the
- # link is external.
+ # Returns the {BasicObj Obj} this link references. Returns +nil+ if the link is external.
# @api public
def obj
@link_data[:obj]
end