Class: Murlsh::Url
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Murlsh::Url
- Defined in:
- lib/murlsh/url.rb
Overview
URL ActiveRecord.
Instance Attribute Summary collapse
-
#user_supplied_title ⇒ Object
(also: #user_supplied_title?)
Returns the value of attribute user_supplied_title.
Instance Method Summary collapse
- #ask ⇒ Object
-
#same_author?(other) ⇒ Boolean
Return true if this url has the same author as another url.
-
#same_thumbnail?(other) ⇒ Boolean
Return true if this url has the same thumbnail url 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 Attribute Details
#user_supplied_title ⇒ Object Also known as: user_supplied_title?
Returns the value of attribute user_supplied_title.
45 46 47 |
# File 'lib/murlsh/url.rb', line 45 def user_supplied_title @user_supplied_title end |
Instance Method Details
#ask ⇒ Object
38 39 40 41 42 43 |
# File 'lib/murlsh/url.rb', line 38 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.
28 29 30 31 |
# File 'lib/murlsh/url.rb', line 28 def (other) other and other.email and other.name and email and name and email == other.email and name == other.name end |
#same_thumbnail?(other) ⇒ Boolean
Return true if this url has the same thumbnail url as another url.
34 35 36 |
# File 'lib/murlsh/url.rb', line 34 def same_thumbnail?(other) other and thumbnail_url == other.thumbnail_url end |
#title ⇒ Object
Get the title of this url.
13 14 15 16 17 18 19 20 21 |
# File 'lib/murlsh/url.rb', line 13 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.
25 |
# File 'lib/murlsh/url.rb', line 25 def title_stripped; title.to_s.strip.gsub(/\s+/, ' '); end |