Class: Sqreen::Ecosystem::Tracing::Sampler::Line
- Inherits:
-
Object
- Object
- Sqreen::Ecosystem::Tracing::Sampler::Line
- Includes:
- Loggable
- Defined in:
- lib/sqreen/ecosystem/tracing/sampler.rb
Instance Attribute Summary collapse
-
#saved_definition ⇒ Object
readonly
Returns the value of attribute saved_definition.
Instance Method Summary collapse
-
#initialize(definition) ⇒ Line
constructor
A new instance of Line.
- #triggers? ⇒ Boolean
Constructor Details
#initialize(definition) ⇒ Line
Returns a new instance of Line.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sqreen/ecosystem/tracing/sampler.rb', line 32 def initialize(definition) @saved_definition = definition @primitives = [] unknown = definition.keys - PRIMITIVES_MAP.keys unless unknown.empty? logger.warn "Unknown primitives: #{unknown}" @primitives << AlwaysFalsePrimitive.instance return end PRIMITIVES_MAP.each do |key, prim_class| next unless definition[key] @primitives << prim_class.new(definition[key]) end # if @primitives is empty the line will always # return true: [].all?(&:triggers?) is true end |
Instance Attribute Details
#saved_definition ⇒ Object (readonly)
Returns the value of attribute saved_definition.
29 30 31 |
# File 'lib/sqreen/ecosystem/tracing/sampler.rb', line 29 def saved_definition @saved_definition end |
Instance Method Details
#triggers? ⇒ Boolean
51 52 53 |
# File 'lib/sqreen/ecosystem/tracing/sampler.rb', line 51 def triggers? @primitives.all?(&:triggers?) end |