Class: Fierce::PresenterFinder
- Inherits:
-
Object
- Object
- Fierce::PresenterFinder
- Defined in:
- lib/fierce/presenter_finder.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #file_path(base_path) ⇒ Object
- #found? ⇒ Boolean
-
#initialize(path) ⇒ PresenterFinder
constructor
A new instance of PresenterFinder.
- #perform ⇒ Object
- #presenter_class ⇒ Object
Constructor Details
#initialize(path) ⇒ PresenterFinder
Returns a new instance of PresenterFinder.
5 6 7 |
# File 'lib/fierce/presenter_finder.rb', line 5 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/fierce/presenter_finder.rb', line 3 def path @path end |
Instance Method Details
#file_path(base_path) ⇒ Object
9 10 11 |
# File 'lib/fierce/presenter_finder.rb', line 9 def file_path(base_path) "#{base_path}/#{path}.rb" end |
#found? ⇒ Boolean
13 14 15 16 17 |
# File 'lib/fierce/presenter_finder.rb', line 13 def found? Fierce.paths.any? do |base_path| File.exist?(file_path(base_path)) end end |
#perform ⇒ Object
19 20 21 |
# File 'lib/fierce/presenter_finder.rb', line 19 def perform presenter_class if found? end |
#presenter_class ⇒ Object
23 24 25 |
# File 'lib/fierce/presenter_finder.rb', line 23 def presenter_class "::#{path.classify}".constantize end |