Class: Vanilla::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vanilla/config.rb

Overview

Create a new Vanilla application Configuration options:

:soup - provide the path to the soup data
:soups - provide an array of paths to soup data
:root - the directory that the soup paths are relative to;
        defaults to Dir.pwd
:renderers - a hash of names to classes
:default_renderer - the class to use when no renderer is provided;
                    defaults to 'Vanilla::Renderers::Base'
:default_layout_snip - the snip to use as a layout when rendering to HTML;
                       defaults to 'layout'
:root_snip - the snip to load for the root ('/') url;
             defaults to 'start'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/vanilla/config.rb', line 28

def initialize
  @root = Dir.pwd
  @root_snip = "start"
  @soups = ["soups/base", "soups/system"]
  @default_layout_snip = "layout"
  @default_renderer = Vanilla::Renderers::Base
  @raise_errors = false
  @renderers = {
    "base" => Vanilla::Renderers::Base,
    "markdown" => Vanilla::Renderers::Markdown,
    "bold" => Vanilla::Renderers::Bold,
    "erb" => Vanilla::Renderers::Erb,
    "rb" => Vanilla::Renderers::Ruby,
    "ruby" => Vanilla::Renderers::Ruby,
    "haml" => Vanilla::Renderers::Haml,
    "raw" => Vanilla::Renderers::Raw,
    "textile" => Vanilla::Renderers::Textile
  }
end

Instance Attribute Details

#default_layout_snipObject

Returns the value of attribute default_layout_snip.



20
21
22
# File 'lib/vanilla/config.rb', line 20

def default_layout_snip
  @default_layout_snip
end

#default_rendererObject

Returns the value of attribute default_renderer.



20
21
22
# File 'lib/vanilla/config.rb', line 20

def default_renderer
  @default_renderer
end

#raise_errorsObject

Returns the value of attribute raise_errors.



20
21
22
# File 'lib/vanilla/config.rb', line 20

def raise_errors
  @raise_errors
end

#renderersObject

Returns the value of attribute renderers.



20
21
22
# File 'lib/vanilla/config.rb', line 20

def renderers
  @renderers
end

#rootObject

Returns the value of attribute root.



20
21
22
# File 'lib/vanilla/config.rb', line 20

def root
  @root
end

#root_snipObject

Returns the value of attribute root_snip.



20
21
22
# File 'lib/vanilla/config.rb', line 20

def root_snip
  @root_snip
end

#soupsObject

Returns the value of attribute soups.



20
21
22
# File 'lib/vanilla/config.rb', line 20

def soups
  @soups
end