Class: Redde::Seo::Finder
- Inherits:
-
Object
- Object
- Redde::Seo::Finder
- Includes:
- Urled
- Defined in:
- app/models/redde/seo/finder.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
-
#object_seo ⇒ Object
Returns the value of attribute object_seo.
-
#result ⇒ Object
Returns the value of attribute result.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #default_seo ⇒ Object
- #find ⇒ Object
- #find_object_seo ⇒ Object
-
#initialize(url, object = nil) ⇒ Finder
constructor
A new instance of Finder.
Methods included from Urled
#create_urled_seo, #default_or_existing_urled_seo, #find_url_seo, #urled_seo_from_db
Constructor Details
#initialize(url, object = nil) ⇒ Finder
Returns a new instance of Finder.
8 9 10 11 |
# File 'app/models/redde/seo/finder.rb', line 8 def initialize(url, object = nil) @url = url @object = object end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
6 7 8 |
# File 'app/models/redde/seo/finder.rb', line 6 def object @object end |
#object_seo ⇒ Object
Returns the value of attribute object_seo.
6 7 8 |
# File 'app/models/redde/seo/finder.rb', line 6 def object_seo @object_seo end |
#result ⇒ Object
Returns the value of attribute result.
6 7 8 |
# File 'app/models/redde/seo/finder.rb', line 6 def result @result end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'app/models/redde/seo/finder.rb', line 6 def url @url end |
Instance Method Details
#default_seo ⇒ Object
24 25 26 |
# File 'app/models/redde/seo/finder.rb', line 24 def default_seo Redde::Seo::DefaultSeo.new end |
#find ⇒ Object
13 14 15 16 17 18 |
# File 'app/models/redde/seo/finder.rb', line 13 def find @result = find_object_seo if object.present? @result = find_url_seo if result.nil? || (result && result.empty?) @result = default_seo if result.nil? || (result && result.empty?) @result end |
#find_object_seo ⇒ Object
20 21 22 |
# File 'app/models/redde/seo/finder.rb', line 20 def find_object_seo Redde::Seo::Finder::Objected.new(url, object).find end |