From 1cf51a88d592f72a958f0716b6f470a0e11114aa Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 26 Nov 2010 11:36:02 +0100 Subject: [PATCH] use extend self pattern instead of defining self.xxx methods all over the place --- app/models/report/filter.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/report/filter.rb b/app/models/report/filter.rb index 0e3b73ea2d..1629379858 100644 --- a/app/models/report/filter.rb +++ b/app/models/report/filter.rb @@ -1,15 +1,17 @@ require "set" module Report::Filter - def self.all + extend self + + def all @all ||= Set[] end - def self.all_grouped + def all_grouped all.group_by { |f| f.applies_for }.to_a.sort { |a,b| a.first.to_s <=> b.first.to_s } end - def self.from_hash + def from_hash raise NotImplementedError end end