Sha256: 048e3086bac2c2c0fd2db64038a5d688b54745bbd291a68d112d045c1fda35b1
Contents?: true
Size: 468 Bytes
Versions: 10
Compression:
Stored size: 468 Bytes
Contents
module Prosperity class MetricFinder < Struct.new(:directory) def metrics Dir[File.join(directory, "**/*_metric.rb")].map do |metric| File.basename(metric, ".rb").camelcase.constantize end end def self.all self.new(File.join(Rails.root, "app/prosperity")).metrics end def self.find_by_name(name) klass = name.constantize if klass < Metric klass else nil end end end end
Version data entries
10 entries across 10 versions & 1 rubygems