Class: Prosperity::MetricFinder
- Inherits:
-
Struct
- Object
- Struct
- Prosperity::MetricFinder
- Defined in:
- lib/prosperity/metric_finder.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
Returns the value of attribute directory.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#directory ⇒ Object
Returns the value of attribute directory
2 3 4 |
# File 'lib/prosperity/metric_finder.rb', line 2 def directory @directory end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/prosperity/metric_finder.rb', line 9 def self.all self.new(File.join(Rails.root, "app/prosperity")).metrics end |
.find_by_name(name) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/prosperity/metric_finder.rb', line 13 def self.find_by_name(name) klass = name.constantize if klass < Metric klass else nil end end |
Instance Method Details
#metrics ⇒ Object
3 4 5 6 7 |
# File 'lib/prosperity/metric_finder.rb', line 3 def metrics Dir[File.join(directory, "**/*_metric.rb")].map do |metric| File.basename(metric, ".rb").camelcase.constantize end end |