Class: Anoubis::Output::Edit
- Defined in:
- app/controllers/anoubis/output/edit.rb
Overview
Output subclass that represents data for edit(new) action
Instance Attribute Summary collapse
-
#action ⇒ String
Additional action after update.
-
#fields ⇒ Array
Array of output fields.
-
#options ⇒ Hash
The hash of additional field options.
-
#title ⇒ String
The title of edit data.
-
#values ⇒ Hash
The hash of defined fields.
Attributes inherited from Basic
Instance Method Summary collapse
-
#initialize ⇒ Edit
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 ⇒ Edit
Initializes menu output data. Generates default values.
29 30 31 32 33 34 35 36 |
# File 'app/controllers/anoubis/output/edit.rb', line 29 def initialize super self.title = '' self.fields = nil self.values = {} self. = {} self.action = '' end |
Instance Attribute Details
#action ⇒ String
Returns additional action after update.
24 |
# File 'app/controllers/anoubis/output/edit.rb', line 24 class_attribute :action |
#fields ⇒ Array
Returns array of output fields.
12 |
# File 'app/controllers/anoubis/output/edit.rb', line 12 class_attribute :fields |
#options ⇒ Hash
Returns the hash of additional field options.
20 |
# File 'app/controllers/anoubis/output/edit.rb', line 20 class_attribute :options, default: {} |
#title ⇒ String
Returns the title of edit data.
8 |
# File 'app/controllers/anoubis/output/edit.rb', line 8 class_attribute :title |
#values ⇒ Hash
Returns the hash of defined fields.
16 |
# File 'app/controllers/anoubis/output/edit.rb', line 16 class_attribute :values, default: {} |
Instance Method Details
#to_h ⇒ Hash
Generates hash representation of output class
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/anoubis/output/edit.rb', line 41 def to_h result = super.to_h return result if self.result != 0 result[:title] = self.title if self.title != '' result[:fields] = self.fields if self.fields result[:action] = self.action if self.action != '' result.merge!({ values: self.values, options: self.(self.) }) result end |