Class: Georgia::Link

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Concerns::Contentable
Defined in:
app/models/georgia/link.rb

Instance Method Summary collapse

Instance Method Details

#ensure_forward_slashObject



16
17
18
19
20
# File 'app/models/georgia/link.rb', line 16

def ensure_forward_slash
  self.contents.each do |content|
    content.text.insert(0, '/') unless content.text =~ Regexp.new('(^/)|(^http)')
  end
end

#slugObject

returns only the last part of the url



23
24
25
# File 'app/models/georgia/link.rb', line 23

def slug
  @slug ||= text.match(/([\w-]*)$/)[0]
end