Class: Chronicle::ETL::SamplerTransformer
- Inherits:
-
Transformer
- Object
- Transformer
- Chronicle::ETL::SamplerTransformer
- Defined in:
- lib/chronicle/etl/transformers/sampler_transformer.rb
Instance Attribute Summary
Attributes inherited from Transformer
Attributes included from Registry::SelfRegistering
Instance Method Summary collapse
-
#transform(record) ⇒ Object
return the result,
percent
percentage of the time.
Methods inherited from Transformer
#call, #call_finish, #finish, #initialize
Methods included from Registry::SelfRegistering
Methods included from Configurable
Constructor Details
This class inherits a constructor from Chronicle::ETL::Transformer
Instance Method Details
#transform(record) ⇒ Object
return the result, percent
percentage of the time. otherwise nil
14 15 16 17 18 |
# File 'lib/chronicle/etl/transformers/sampler_transformer.rb', line 14 def transform(record) return unless rand(100) < @config.percent record.data end |