Class: FrequencyAnalyser::Aggregator
- Inherits:
-
Struct
- Object
- Struct
- FrequencyAnalyser::Aggregator
- Defined in:
- lib/frequency_analyser/aggregator.rb
Instance Attribute Summary collapse
-
#aggregation ⇒ Object
Returns the value of attribute aggregation.
-
#counter ⇒ Object
Returns the value of attribute counter.
Class Method Summary collapse
Instance Method Summary collapse
- #aggregate(*files) ⇒ Object
-
#initialize(counter = fa::Counter, aggregation = fa::Aggregation.new) ⇒ Aggregator
constructor
A new instance of Aggregator.
Constructor Details
#initialize(counter = fa::Counter, aggregation = fa::Aggregation.new) ⇒ Aggregator
Returns a new instance of Aggregator.
3 4 5 |
# File 'lib/frequency_analyser/aggregator.rb', line 3 def initialize(counter = fa::Counter, aggregation = fa::Aggregation.new) super end |
Instance Attribute Details
#aggregation ⇒ Object
Returns the value of attribute aggregation
1 2 3 |
# File 'lib/frequency_analyser/aggregator.rb', line 1 def aggregation @aggregation end |
#counter ⇒ Object
Returns the value of attribute counter
1 2 3 |
# File 'lib/frequency_analyser/aggregator.rb', line 1 def counter @counter end |
Class Method Details
.aggregate(*files) ⇒ Object
7 8 9 |
# File 'lib/frequency_analyser/aggregator.rb', line 7 def self.aggregate(*files) new.aggregate(*files) end |
Instance Method Details
#aggregate(*files) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/frequency_analyser/aggregator.rb', line 11 def aggregate(*files) files = coerce(files) files.each do |file| file.each_line do |line| aggregation << counter.count(line) end reset(file) end aggregation end |