class Prosperity::MetricFinder

Public Class Methods

all() click to toggle source
# 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) click to toggle source
# 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

Public Instance Methods

metrics() click to toggle source
# 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