Class: Axiom::Algebra::Summarization
- Includes:
- Relation::Operation::Unary
- Defined in:
- lib/axiom/algebra/summarization.rb,
lib/axiom/algebra/summarization/summary.rb,
lib/axiom/algebra/summarization/summaries.rb
Overview
Summarize a relation by specific attributes
Defined Under Namespace
Modules: Methods Classes: Summaries, Summary
Instance Attribute Summary collapse
-
#summarize_per ⇒ Relation
readonly
private
The relation to summarize with.
-
#summarizers ⇒ Hash
readonly
private
The summarizers for the relation.
Attributes included from Operation::Unary
Attributes inherited from Relation
Class Method Summary collapse
-
.new(operand, summarize_per, _summarizers) ⇒ Summarization
Instantiate a new Summarization.
Instance Method Summary collapse
-
#delete ⇒ undefined
Raise an exception when deleting from a Summarization.
-
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set.
-
#initialize(operand, summarize_per, summarizers) ⇒ undefined
constructor
private
Initialize a Summarization.
-
#insert ⇒ undefined
Raise an exception when inserting into a Summarization.
Methods inherited from Relation
#==, #[], #directions, #empty?, #include?, #materialize, #materialized?, #replace
Methods included from Visitable
Constructor Details
#initialize(operand, summarize_per, summarizers) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a Summarization
76 77 78 79 80 81 |
# File 'lib/axiom/algebra/summarization.rb', line 76 def initialize(operand, summarize_per, summarizers) super(operand) @summarize_per = summarize_per @summarizers = summarizers @header = @summarize_per.header | @summarizers.keys end |
Instance Attribute Details
#summarize_per ⇒ Relation (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The relation to summarize with
16 17 18 |
# File 'lib/axiom/algebra/summarization.rb', line 16 def summarize_per @summarize_per end |
#summarizers ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The summarizers for the relation
23 24 25 |
# File 'lib/axiom/algebra/summarization.rb', line 23 def summarizers @summarizers end |
Class Method Details
.new(operand, summarize_per, _summarizers) ⇒ Summarization
Instantiate a new Summarization
40 41 42 43 |
# File 'lib/axiom/algebra/summarization.rb', line 40 def self.new(operand, summarize_per, _summarizers) assert_subset_headers(operand, summarize_per) super end |
Instance Method Details
#delete ⇒ undefined
Raise an exception when deleting from a Summarization
129 130 131 |
# File 'lib/axiom/algebra/summarization.rb', line 129 def delete(*) fail ImmutableRelationError, 'deleting from a summarization is impossible' end |
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set
97 98 99 100 101 |
# File 'lib/axiom/algebra/summarization.rb', line 97 def each return to_enum unless block_given? summarize_per.extend(summaries).each { |tuple| yield tuple } self end |
#insert ⇒ undefined
Raise an exception when inserting into a Summarization
114 115 116 |
# File 'lib/axiom/algebra/summarization.rb', line 114 def insert(*) fail ImmutableRelationError, 'inserting into a summarization is impossible' end |