Class: Columbus::Link

Inherits:
Struct
  • Object
show all
Defined in:
lib/columbus/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hrefObject

Returns the value of attribute href

Returns:

  • (Object)

    the current value of href



2
3
4
# File 'lib/columbus/link.rb', line 2

def href
  @href
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



2
3
4
# File 'lib/columbus/link.rb', line 2

def title
  @title
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



2
3
4
# File 'lib/columbus/link.rb', line 2

def url
  @url
end

Instance Method Details

#absolute_urlObject



7
8
9
10
11
12
13
# File 'lib/columbus/link.rb', line 7

def absolute_url
  if relative?
    "#{url}#{href}"
  else
    "#{href}"
  end
end

#clean_titleObject



3
4
5
# File 'lib/columbus/link.rb', line 3

def clean_title
  title.nil? ? nil : title.strip
end

#relative?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/columbus/link.rb', line 15

def relative?
  href =~ /^\//
end