Class: Murlsh::Url
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Murlsh::Url
- Defined in:
- lib/murlsh/url.rb
Overview
URL ActiveRecord.
Instance Method Summary collapse
- #ask ⇒ Object
-
#same_author?(other) ⇒ Boolean
Return true if this url has the same author as another url.
-
#title ⇒ Object
Get the title of this url.
-
#title_stripped ⇒ Object
Title with whitespace compressed and leading and trailing whitespace stripped.
Instance Method Details
#ask ⇒ Object
32 33 34 35 36 37 |
# File 'lib/murlsh/url.rb', line 32 def ask if !defined?(@ask) or @ask.to_s != url @ask = URI(url).extend(Murlsh::UriAsk) end @ask end |
#same_author?(other) ⇒ Boolean
Return true if this url has the same author as another url.
27 28 29 30 |
# File 'lib/murlsh/url.rb', line 27 def (other) other and other.email and other.name and email and name and email == other.email and name == other.name end |
#title ⇒ Object
Get the title of this url.
12 13 14 15 16 17 18 19 20 |
# File 'lib/murlsh/url.rb', line 12 def title ta = read_attribute(:title) ta = nil if ta and ta.empty? ua = read_attribute(:url) ua = nil if ua and ua.empty? ta || ua || 'title missing' end |
#title_stripped ⇒ Object
Title with whitespace compressed and leading and trailing whitespace stripped.
24 |
# File 'lib/murlsh/url.rb', line 24 def title_stripped; title.strip.gsub(/\s+/, ' '); end |