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