Sha256: a3f424879a1292004c11e579667873567c9244fa6339caede9003fa18013b51b
Contents?: true
Size: 571 Bytes
Versions: 15
Compression:
Stored size: 571 Bytes
Contents
class ServiceSkeleton module MetricsMethods def service=(svc) @service = svc end def register(metric) method_name = metric.name.to_s.gsub(/\A#{Regexp.quote(@service.service_name)}_/, '').to_sym if self.class.method_defined?(method_name) raise ServiceSkeleton::Error::InvalidMetricNameError, "There is already a method named #{method_name} on ##metrics, so you can't have a metric named #{metric.name}" end define_singleton_method(method_name) do metric end super end end end
Version data entries
15 entries across 15 versions & 1 rubygems