Class: RDaux::Web::Site::Section
- Inherits:
-
Object
- Object
- RDaux::Web::Site::Section
- Defined in:
- lib/rdaux/web/site.rb
Instance Attribute Summary collapse
- #contents ⇒ Object
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Summary collapse
- #has_children? ⇒ Boolean
- #has_contents? ⇒ Boolean
-
#initialize(key) ⇒ Section
constructor
A new instance of Section.
- #title ⇒ Object
Constructor Details
#initialize(key) ⇒ Section
Returns a new instance of Section.
11 12 13 |
# File 'lib/rdaux/web/site.rb', line 11 def initialize(key) @key = key end |
Instance Attribute Details
#contents ⇒ Object
19 20 21 |
# File 'lib/rdaux/web/site.rb', line 19 def contents @contents && @contents.read end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/rdaux/web/site.rb', line 7 def key @key end |
#sections ⇒ Object
Returns the value of attribute sections.
9 10 11 |
# File 'lib/rdaux/web/site.rb', line 9 def sections @sections end |
Instance Method Details
#has_children? ⇒ Boolean
23 24 25 |
# File 'lib/rdaux/web/site.rb', line 23 def has_children? @sections && !@sections.empty? end |
#has_contents? ⇒ Boolean
27 28 29 |
# File 'lib/rdaux/web/site.rb', line 27 def has_contents? !@contents.nil? end |
#title ⇒ Object
15 16 17 |
# File 'lib/rdaux/web/site.rb', line 15 def title @title ||= @key.split('-').map(&:capitalize).join(' ') end |