Class: Request::ChangeDecision
- Inherits:
-
Object
- Object
- Request::ChangeDecision
- Includes:
- Validateable
- Defined in:
- app/models/request/change_decision.rb
Defined Under Namespace
Classes: ChangeDecisionError
Constant Summary collapse
- InvalidDecision =
Class.new(ChangeDecisionError)
Instance Attribute Summary collapse
-
#asset_qc_state ⇒ Object
Returns the value of attribute asset_qc_state.
-
#asset_qc_state_check_box ⇒ Object
Returns the value of attribute asset_qc_state_check_box.
-
#change_decision_check_box ⇒ Object
Returns the value of attribute change_decision_check_box.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#request ⇒ Object
Returns the value of attribute request.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #asset_qc_state_absent? ⇒ Boolean
- #checkboxes ⇒ Object
- #execute! ⇒ Object
-
#initialize(attributes) ⇒ ChangeDecision
constructor
A new instance of ChangeDecision.
- #state_change? ⇒ Boolean
Methods included from Validateable
append_features, #method_missing, #validate!
Constructor Details
#initialize(attributes) ⇒ ChangeDecision
Returns a new instance of ChangeDecision.
39 40 41 |
# File 'app/models/request/change_decision.rb', line 39 def initialize(attributes) attributes.each { |k, v| send(:"#{k}=", v) } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Validateable
Instance Attribute Details
#asset_qc_state ⇒ Object
Returns the value of attribute asset_qc_state.
15 16 17 |
# File 'app/models/request/change_decision.rb', line 15 def asset_qc_state @asset_qc_state end |
#asset_qc_state_check_box ⇒ Object
Returns the value of attribute asset_qc_state_check_box.
15 16 17 |
# File 'app/models/request/change_decision.rb', line 15 def asset_qc_state_check_box @asset_qc_state_check_box end |
#change_decision_check_box ⇒ Object
Returns the value of attribute change_decision_check_box.
15 16 17 |
# File 'app/models/request/change_decision.rb', line 15 def change_decision_check_box @change_decision_check_box end |
#comment ⇒ Object
Returns the value of attribute comment.
15 16 17 |
# File 'app/models/request/change_decision.rb', line 15 def comment @comment end |
#request ⇒ Object
Returns the value of attribute request.
15 16 17 |
# File 'app/models/request/change_decision.rb', line 15 def request @request end |
#user ⇒ Object
Returns the value of attribute user.
15 16 17 |
# File 'app/models/request/change_decision.rb', line 15 def user @user end |
Instance Method Details
#asset_qc_state_absent? ⇒ Boolean
47 48 49 |
# File 'app/models/request/change_decision.rb', line 47 def asset_qc_state_absent? asset_qc_state_check_box == '0' || asset_qc_state_check_box.nil? end |
#checkboxes ⇒ Object
17 18 19 |
# File 'app/models/request/change_decision.rb', line 17 def checkboxes [change_decision_check_box, asset_qc_state_check_box] end |
#execute! ⇒ Object
51 52 53 54 55 |
# File 'app/models/request/change_decision.rb', line 51 def execute! raise InvalidDecision, self unless valid? perform_decision_change! end |
#state_change? ⇒ Boolean
43 44 45 |
# File 'app/models/request/change_decision.rb', line 43 def state_change? change_decision_check_box == '1' end |