Module: KPI::Report::DynamicDefinitions::ClassMethods
- Defined in:
- app/models/kpi/report/dynamic_definitions.rb
Instance Method Summary collapse
- #blacklist(*methods) ⇒ Object
- #defined_kpis ⇒ Object
- #method_added(name) ⇒ Object
- #method_blacklisted?(name) ⇒ Boolean
- #not_kpi_methods ⇒ Object
Instance Method Details
#blacklist(*methods) ⇒ Object
19 20 21 |
# File 'app/models/kpi/report/dynamic_definitions.rb', line 19 def blacklist(*methods) not_kpi_methods.push *methods end |
#defined_kpis ⇒ Object
23 24 25 |
# File 'app/models/kpi/report/dynamic_definitions.rb', line 23 def defined_kpis @kpi_methods ||= [] end |
#method_added(name) ⇒ Object
5 6 7 8 9 10 |
# File 'app/models/kpi/report/dynamic_definitions.rb', line 5 def method_added(name) unless self.method_blacklisted?(name) || suppressed_memoization? self.defined_kpis << name suppress_memoization { memoize name } end end |
#method_blacklisted?(name) ⇒ Boolean
12 13 14 15 16 17 |
# File 'app/models/kpi/report/dynamic_definitions.rb', line 12 def method_blacklisted?(name) KPI::Report.not_kpi_methods.include?(name) || not_kpi_methods.include?(name) || name =~ /_unmemoized_/ || !self.instance_methods(true).map(&:to_sym).include?(name) end |
#not_kpi_methods ⇒ Object
27 28 29 |
# File 'app/models/kpi/report/dynamic_definitions.rb', line 27 def not_kpi_methods @not_kpi_methods ||= [] end |