class Semistatic::Configuration

Public Class Methods

new() click to toggle source
# File lib/semistatic/configuration.rb, line 7
def initialize
  @templates_path = Rails.root. + 'app/views/layout'
  @config_files = [(Rails.root. + 'config/semistatic.yml')]
  @config = HashWithIndifferentAccess.new({pages: {}})
end

Public Instance Methods

config_files() click to toggle source

get the config files @return Array # the filepaths in a array

# File lib/semistatic/configuration.rb, line 33
def config_files
  @config_files
end
config_files=(files) click to toggle source

set the config files @param Array files # the filepaths in a array

# File lib/semistatic/configuration.rb, line 27
def config_files=(files)
  @config_files = files
end
load() click to toggle source

load config from files

# File lib/semistatic/configuration.rb, line 38
def load
  config_files.each do |file|
    config = YAML::load(File.open(file))
    @config.merge! config
  end
end
page(key) click to toggle source

@param Symbol key @return hash

# File lib/semistatic/configuration.rb, line 52
def page(key)
  page = pages[key]
  raise Error.new("There is no page named '#{key}'") unless page
  page
end
pages() click to toggle source

@return Hash

# File lib/semistatic/configuration.rb, line 46
def pages
  @config[:pages]
end
templates_path() click to toggle source

get the template path @return Pathname

# File lib/semistatic/configuration.rb, line 21
def templates_path
  @templates_path
end
templates_path=(path) click to toggle source

set the template path @param Pathname path

# File lib/semistatic/configuration.rb, line 15
def templates_path=(path)
  @templates_path = path
end