From c066d1ee6da07864e0c1ac0d91ea60461b0f6b49 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 3 Dec 2010 16:51:11 +0100 Subject: [PATCH] module vs. class --- app/models/report/filter.rb | 10 ++++------ app/models/report/filter/base.rb | 2 +- app/models/report/group_by/ruby_aggregation.rb | 2 +- app/models/report/group_by/singleton_value.rb | 2 +- app/models/report/group_by/sql_aggregation.rb | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/models/report/filter.rb b/app/models/report/filter.rb index 1629379858..71b9555645 100644 --- a/app/models/report/filter.rb +++ b/app/models/report/filter.rb @@ -1,17 +1,15 @@ require "set" -module Report::Filter - extend self - - def all +class Report::Filter + def self.all @all ||= Set[] end - def all_grouped + def self.all_grouped all.group_by { |f| f.applies_for }.to_a.sort { |a,b| a.first.to_s <=> b.first.to_s } end - def from_hash + def self.from_hash raise NotImplementedError end end diff --git a/app/models/report/filter/base.rb b/app/models/report/filter/base.rb index 2d0b5e9bd4..43aa02af7a 100644 --- a/app/models/report/filter/base.rb +++ b/app/models/report/filter/base.rb @@ -1,4 +1,4 @@ -module Report::Filter +class Report::Filter class Base < Report::Chainable Report::Operator.load diff --git a/app/models/report/group_by/ruby_aggregation.rb b/app/models/report/group_by/ruby_aggregation.rb index 63ca753baf..f68d18e36c 100644 --- a/app/models/report/group_by/ruby_aggregation.rb +++ b/app/models/report/group_by/ruby_aggregation.rb @@ -1,4 +1,4 @@ -module Report::GroupBy +class Report::GroupBy module RubyAggregation def responsible_for_sql? false diff --git a/app/models/report/group_by/singleton_value.rb b/app/models/report/group_by/singleton_value.rb index 7f0c107c48..61ac1f5103 100644 --- a/app/models/report/group_by/singleton_value.rb +++ b/app/models/report/group_by/singleton_value.rb @@ -1,4 +1,4 @@ -module Report::GroupBy +class Report::GroupBy class SingletonValue < Base dont_display! end diff --git a/app/models/report/group_by/sql_aggregation.rb b/app/models/report/group_by/sql_aggregation.rb index b6c3718dfb..0d814fdcd2 100644 --- a/app/models/report/group_by/sql_aggregation.rb +++ b/app/models/report/group_by/sql_aggregation.rb @@ -1,4 +1,4 @@ -module Report::GroupBy +class Report::GroupBy module SqlAggregation def responsible_for_sql? true