Class: Orthor::StaticPage

Inherits:
Object
  • Object
show all
Includes:
HttpCaching, MetaData
Defined in:
lib/orthor/static_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HttpCaching

#cache_for

Constructor Details

#initialize(path, options = {}) ⇒ StaticPage

Returns a new instance of StaticPage.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
# File 'lib/orthor/static_page.rb', line 9

def initialize(path, options = {})
  @path = path
  raise ArgumentError, "Path required" unless @path

  options.each { |key, val| send(key, val) }
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/orthor/static_page.rb', line 6

def path
  @path
end

Instance Method Details

#path_nameObject



20
21
22
# File 'lib/orthor/static_page.rb', line 20

def path_name
  @path.gsub("/", " ").strip.gsub(/[^a-z0-9]+/i, '_')
end

#titleObject



16
17
18
# File 'lib/orthor/static_page.rb', line 16

def title
  name
end