Class: Renalware::Pathology::Requests::Cell

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/pathology/requests/global_rule_sets_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_description, clinic, rule_sets) ⇒ Cell

Returns a new instance of Cell.



41
42
43
44
45
# File 'app/models/renalware/pathology/requests/global_rule_sets_table.rb', line 41

def initialize(request_description, clinic, rule_sets)
  @request_description = request_description
  @clinic = clinic
  @rule_sets = rule_sets
end

Instance Attribute Details

#clinicObject (readonly)

Returns the value of attribute clinic.



39
40
41
# File 'app/models/renalware/pathology/requests/global_rule_sets_table.rb', line 39

def clinic
  @clinic
end

#request_descriptionObject (readonly)

Returns the value of attribute request_description.



39
40
41
# File 'app/models/renalware/pathology/requests/global_rule_sets_table.rb', line 39

def request_description
  @request_description
end

Instance Method Details

#grouped_rule_setsObject



51
52
53
54
55
# File 'app/models/renalware/pathology/requests/global_rule_sets_table.rb', line 51

def grouped_rule_sets
  @grouped_rule_sets ||= @rule_sets.group_by do |rule_set|
    [rule_set.request_description_id, rule_set.clinic_id]
  end
end

#rule_setsObject



47
48
49
# File 'app/models/renalware/pathology/requests/global_rule_sets_table.rb', line 47

def rule_sets
  grouped_rule_sets.fetch([request_description.id, clinic.id], [])
end