Class: Anoubis::Output::Update
- Defined in:
- app/controllers/anoubis/output/update.rb
Overview
Output subclass that represents data for update or create action
Instance Attribute Summary collapse
-
#action ⇒ String
Resulting post action.
-
#errors ⇒ Array<String>
Hash of errors.
-
#values ⇒ Hash
The hash of defined fields.
Attributes inherited from Basic
#messages, #result, #tab, #title
Instance Method Summary collapse
-
#initialize ⇒ Update
constructor
Initializes menu output data.
-
#to_h ⇒ Hash
Generates hash representation of output class.
Methods inherited from Basic
#hash_to_json, #message, #options_to_json
Constructor Details
#initialize ⇒ Update
Initializes menu output data. Generates default values.
20 21 22 23 24 25 26 |
# File 'app/controllers/anoubis/output/update.rb', line 20 def initialize super self.values = {} self.errors = [] self.action = '' self.[:'-3'] = I18n.t('errors.update_error') end |
Instance Attribute Details
#action ⇒ String
Returns resulting post action.
16 |
# File 'app/controllers/anoubis/output/update.rb', line 16 class_attribute :action, default: '' |
#errors ⇒ Array<String>
Returns hash of errors.
12 |
# File 'app/controllers/anoubis/output/update.rb', line 12 class_attribute :errors, default: [] |
#values ⇒ Hash
Returns the hash of defined fields.
8 |
# File 'app/controllers/anoubis/output/update.rb', line 8 class_attribute :values, default: {} |
Instance Method Details
#to_h ⇒ Hash
Generates hash representation of output class
31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/anoubis/output/update.rb', line 31 def to_h result = super.to_h result[:errors] = self.errors if self.errors.length > 0 return result if self.result != 0 result.merge!({ values: self.values, action: self.action }) result end |