Class: Wukong::Processor::Sample
- Inherits:
-
Filter
- Object
- Hanuman::Stage
- Wukong::Processor
- Filter
- Wukong::Processor::Sample
- Defined in:
- lib/wukong/widget/filters.rb
Overview
A widget which samples a certain fraction of input records.
Constant Summary
Constants inherited from Wukong::Processor
Instance Attribute Summary
Attributes included from Hanuman::StageInstanceMethods
Instance Method Summary collapse
-
#select?(record) ⇒ true, false
Selects a
record
randomly, with a probability given the thefraction
for this widget.
Methods inherited from Filter
Methods inherited from Wukong::Processor
configure, description, #finalize, #perform_action, #process, #receive_action, #setup, #stop
Methods included from Logging
Methods inherited from Hanuman::Stage
Methods included from Hanuman::StageClassMethods
#builder, #label, #register, #set_builder
Methods included from Hanuman::StageInstanceMethods
#add_link, #linkable_name, #root
Instance Method Details
#select?(record) ⇒ true, false
Selects a record
randomly, with a probability given the the
fraction
for this widget.
313 314 315 |
# File 'lib/wukong/widget/filters.rb', line 313 def select?(record) rand() < fraction end |