class Serum::Rails::Metrics

Attributes

metrics[R]

Public Class Methods

new(root) click to toggle source
# File lib/serum/rails/metrics.rb, line 19
def initialize(root)
  @app = App.new(root)
end

Private Class Methods

metric(name, &block) click to toggle source
# File lib/serum/rails/metrics.rb, line 11
def metric(name, &block)
  @metrics ||= []
  @metrics << name
  define_method name, &block
end

Public Instance Methods

to_hash() click to toggle source
# File lib/serum/rails/metrics.rb, line 111
def to_hash
  hash = {}
  self.class.metrics.sort_by(&:to_s).each do |metric|
    hash[metric] = send(metric)
  end
  hash
end