Skip to content

Instantly share code, notes, and snippets.

@gmgent
Created April 23, 2011 06:45
Show Gist options
  • Save gmgent/938418 to your computer and use it in GitHub Desktop.
Save gmgent/938418 to your computer and use it in GitHub Desktop.
drug_record_data_grid_presenter.rb
class DrugRecordDataGridPresenter
extend Forwardable
attr_reader :data_grid, :view
def_delegators :data_grid, :each_row, :each_header_group, :configure_unit_field_formatters
def initialize(options = {})
@data_grid = options[:grid]
@view = options[:view]
data_grid.configure_format("Drug") { |drug_record, attribute_name| drug_record.full_drug_name }
data_grid.configure_format("Population") { |drug_record, attribute_name| drug_record.full_population_name }
data_grid.configure_format("Indication") { |drug_record, attribute_name| drug_record.full_indication_name }
data_grid.configure_format("Indication Descriptor") { |drug_record, attribute_name| drug_record.indication.description }
data_grid.configure_format("Care Area") { |drug_record, attribute_name| drug_record.care_area.name }
data_grid.configure_format("Delivery Method") { |drug_record, attribute_name| drug_record.full_delivery_method_name }
data_grid.configure_format("Status") { |drug_record, attribute_name| drug_record.approval_status.name }
data_grid.configure_format("Dosing Adjustment") { |drug_record, attribute_name| drug_record.dosing_adjustment_information }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment