Sha256: 029c4169f9b8efdf977ddd9037eb3c4485c583e9a7325e684a7cb79287572750
Contents?: true
Size: 685 Bytes
Versions: 3
Compression:
Stored size: 685 Bytes
Contents
module Fierce class PresenterFinder attr_reader :path def initialize(path) @path = path end def root Rails.root.to_s end def file_path(base_path) "#{base_path}/#{path}.rb" end def found @found = Fierce.paths.map do |base_path| base_path if File.exist?(file_path(base_path)) end.compact.first end def perform presenter_class if found end def path_to_classify found .gsub(root, '') .gsub('/app', '') .gsub(/\.rb$/, '') + "/#{path}" end def presenter_class require file_path(found) path_to_classify.classify.constantize end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fierce-0.1.2 | lib/fierce/presenter_finder.rb |
fierce-0.1.1 | lib/fierce/presenter_finder.rb |
fierce-0.1.0 | lib/fierce/presenter_finder.rb |