Class: RDaux::Web::Site::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/rdaux/web/site.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentsObject



19
20
21
# File 'lib/rdaux/web/site.rb', line 19

def contents
  @contents && @contents.read
end

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/rdaux/web/site.rb', line 7

def key
  @key
end

#sectionsObject

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

Returns:

  • (Boolean)


23
24
25
# File 'lib/rdaux/web/site.rb', line 23

def has_children?
  @sections && !@sections.empty?
end

#has_contents?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/rdaux/web/site.rb', line 27

def has_contents?
  !@contents.nil?
end

#titleObject



15
16
17
# File 'lib/rdaux/web/site.rb', line 15

def title
  @title ||= @key.split('-').map(&:capitalize).join(' ')
end