Class: Calculation

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/calculation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Calculation

Returns a new instance of Calculation


7
8
9
10
11
12
13
14
15
16
# File 'app/models/calculation.rb', line 7

def initialize(attrs = {})
  local_attrs = attrs.dup
  local_attrs[:available_help] = attrs.fetch(:available_help, :undecided).to_sym
  self.fields_required = []
  self.required_fields_affecting_likelihood = []
  self.messages = []
  self.fields = {}
  local_attrs[:inputs] = CalculationForm.new(local_attrs.fetch(:inputs, {})).export
  super local_attrs
end

Instance Attribute Details

#available_helpObject

Returns the value of attribute available_help


3
4
5
# File 'app/models/calculation.rb', line 3

def available_help
  @available_help
end

#fieldsObject

Returns the value of attribute fields


4
5
6
# File 'app/models/calculation.rb', line 4

def fields
  @fields
end

#fields_requiredObject

Returns the value of attribute fields_required


3
4
5
# File 'app/models/calculation.rb', line 3

def fields_required
  @fields_required
end

#final_decision_byObject

Returns the value of attribute final_decision_by


5
6
7
# File 'app/models/calculation.rb', line 5

def final_decision_by
  @final_decision_by
end

#inputsObject

Returns the value of attribute inputs


3
4
5
# File 'app/models/calculation.rb', line 3

def inputs
  @inputs
end

#messagesObject

Returns the value of attribute messages


4
5
6
# File 'app/models/calculation.rb', line 4

def messages
  @messages
end

#remissionObject

Returns the value of attribute remission


3
4
5
# File 'app/models/calculation.rb', line 3

def remission
  @remission
end

#required_fields_affecting_likelihoodObject

Returns the value of attribute required_fields_affecting_likelihood


4
5
6
# File 'app/models/calculation.rb', line 4

def required_fields_affecting_likelihood
  @required_fields_affecting_likelihood
end