Sha256: 9909480dc5ea24ec11b0669e95afd81b9a162b009b7d952d8a432cad3baa1f3e

Contents?: true

Size: 557 Bytes

Versions: 11

Compression:

Stored size: 557 Bytes

Contents

module Martyr
  module Schema
    class CustomMetric < BaseMetric

      attr_accessor :block, :depends_on

      def build_data_slice(*)
        raise Runtime::Error.new("Custom metrics cannot be sliced: attempted on metric `#{name}`")
      end

      def build_memory_slice(*args)
        Runtime::MetricMemorySlice.new(self, *args)
      end

      # @param fact_scopes [Runtime::FactScopeCollection]
      def add_to_select(fact_scopes)
        # no-op
      end

      def extract(fact)
        fact.instance_exec(&block)
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
martyr-0.1.85.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.84.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.82.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.81.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.80.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.79.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.78.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.77.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.76.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.75.pre lib/martyr/schema/metrics/custom_metric.rb
martyr-0.1.74.pre lib/martyr/schema/metrics/custom_metric.rb