module Qrda::Export::Helper::PopulationSelectors
Public Instance Methods
denominator()
click to toggle source
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 9 def denominator populations.find {|pop| pop.type == 'DENOM'} end
denominator_exceptions()
click to toggle source
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 13 def denominator_exceptions populations.find {|pop| pop.type == 'DENEXCEP'} end
denominator_exclusions()
click to toggle source
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 17 def denominator_exclusions populations.find {|pop| pop.type == 'DENEX'} end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 34 def method_missing(method, *args, &block) match_data = method.to_s.match(/^(.+)_count$/) if match_data population = send(match_data[1]) if population population.value else 0 end else super end end
multiple_population_types?()
click to toggle source
Returns true if there is more than one IPP or DENOM, etc.
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 54 def multiple_population_types? population_groups = populations.group_by(&:type) population_groups.values.any? { |pops| pops.size > 1 } end
numerator()
click to toggle source
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 5 def numerator populations.find {|pop| pop.type == 'NUMER'} end
population_count(population_type, population_id)
click to toggle source
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 21 def population_count(population_type, population_id) population = populations.find {|pop| pop.type == population_type && pop.id == population_id} if population population.value else 0 end end
population_id(population_type)
click to toggle source
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 30 def population_id(population_type) populations.find {|pop| pop.type == population_type}.id end
respond_to_missing?(method, *args)
click to toggle source
Calls superclass method
# File lib/qrda-export/helper/aggregate_object_helper.rb, line 48 def respond_to_missing?(method, *args) match_data = method.to_s.match(/^(.+)_count$/) !match_data.nil? or super end