Class: GatherContent::Config::Tab
- Inherits:
-
Object
- Object
- GatherContent::Config::Tab
- Defined in:
- lib/gather_content/config/tab.rb
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(label = "", name = "", hidden = false, elements = []) ⇒ Tab
constructor
A new instance of Tab.
- #serialize(options = nil) ⇒ Object
- #to_json(options = nil) ⇒ Object
Constructor Details
#initialize(label = "", name = "", hidden = false, elements = []) ⇒ Tab
6 7 8 9 10 11 |
# File 'lib/gather_content/config/tab.rb', line 6 def initialize(label = "", name = "", hidden = false, elements = []) self.label = label self.name = name self.hidden = hidden self.elements = elements end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
4 5 6 |
# File 'lib/gather_content/config/tab.rb', line 4 def elements @elements end |
#hidden ⇒ Object
Returns the value of attribute hidden.
4 5 6 |
# File 'lib/gather_content/config/tab.rb', line 4 def hidden @hidden end |
#label ⇒ Object
Returns the value of attribute label.
4 5 6 |
# File 'lib/gather_content/config/tab.rb', line 4 def label @label end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/gather_content/config/tab.rb', line 4 def name @name end |
Instance Method Details
#serialize(options = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gather_content/config/tab.rb', line 13 def serialize( = nil) raise ArgumentError, "name is required" unless name.present? raise ArgumentError, "label is required" unless label.present? { label: label, name: name, hidden: !!hidden, elements: elements.map{ |el| el.serialize() } } end |
#to_json(options = nil) ⇒ Object
25 26 27 |
# File 'lib/gather_content/config/tab.rb', line 25 def to_json( = nil) serialize.to_json() end |