Class: Anoubis::Output::Frame
- Defined in:
- app/controllers/anoubis/output/frame.rb
Overview
Output subclass that represents data for frame action
Instance Attribute Summary collapse
-
#access ⇒ String
The access to the menu element for current user (‘read’, ‘write’).
-
#mode ⇒ string
The identificator for current frame.
-
#short ⇒ string
The short title of current loaded frame.
-
#tab_items ⇒ Array
The array of tab elements TabItem.
-
#tabs ⇒ Hash
The hash of menu elements TabItem with ‘mode’ as a key.
Attributes inherited from Basic
#messages, #result, #tab, #title
Instance Method Summary collapse
-
#addTab(options) ⇒ Object
Adds new tab into tabs hash.
-
#initialize ⇒ Frame
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 ⇒ Frame
Initializes menu output data. Generates default values.
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/anoubis/output/frame.rb', line 28 def initialize super self.title = '' self.short = '' self.mode = '' self.access = 'read' self.tab_items = [] self.tabs = {} end |
Instance Attribute Details
#access ⇒ String
Returns the access to the menu element for current user (‘read’, ‘write’).
16 |
# File 'app/controllers/anoubis/output/frame.rb', line 16 class_attribute :access |
#mode ⇒ string
Returns the identificator for current frame.
12 |
# File 'app/controllers/anoubis/output/frame.rb', line 12 class_attribute :mode |
#short ⇒ string
Returns the short title of current loaded frame.
8 |
# File 'app/controllers/anoubis/output/frame.rb', line 8 class_attribute :short |
#tab_items ⇒ Array
Returns the array of tab elements TabItem.
20 |
# File 'app/controllers/anoubis/output/frame.rb', line 20 class_attribute :tab_items |
#tabs ⇒ Hash
Returns the hash of menu elements TabItem with ‘mode’ as a key.
24 |
# File 'app/controllers/anoubis/output/frame.rb', line 24 class_attribute :tabs |
Instance Method Details
#addTab(options) ⇒ Object
Adds new tab into tabs hash
44 45 46 47 48 |
# File 'app/controllers/anoubis/output/frame.rb', line 44 def addTab() tab = TabItem.new self.tab_items.push tab self.tabs[tab.tab.to_s.to_sym] = self.tab_items[self.tab_items.count-1] end |
#to_h ⇒ Hash
Generates hash representation of output class
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/anoubis/output/frame.rb', line 53 def to_h result = super.to_h return result if self.result != 0 result[:short] = self.short result[:mode] = self.mode result[:access] = self.access result[:tabs] = [] self.tab_items.each { |item| result[:tabs].push(item.to_h) if item } result end |