Class: Refinery::Pages::FinderByPathOrId
- Inherits:
-
Object
- Object
- Refinery::Pages::FinderByPathOrId
- Defined in:
- lib/refinery/pages/finder.rb
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(path, id) ⇒ FinderByPathOrId
constructor
A new instance of FinderByPathOrId.
Constructor Details
#initialize(path, id) ⇒ FinderByPathOrId
Returns a new instance of FinderByPathOrId.
158 159 160 161 |
# File 'lib/refinery/pages/finder.rb', line 158 def initialize(path, id) @path = path @id = id end |
Instance Method Details
#find ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/refinery/pages/finder.rb', line 163 def find if path.present? if path.friendly_id? FinderByPath.new(path).find else Page.friendly.find(path) end elsif id.present? Page.friendly.find(id) end end |