Class: Juli::Util::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/juli/util.rb

Overview

config with hard-coded default

Defined Under Namespace

Classes: Error

Constant Summary collapse

DEFAULT =
{
  'ext'                       => '.shtml',
  'output_top'                => '../html',
  'show_indent_toggle_button' => true,
  'template'                  => 'default.html',
  'link_wikiname_on'          => '1st-only',
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



143
144
145
146
147
148
149
150
151
152
# File 'lib/juli/util.rb', line 143

def initialize
  path  = File.join(Juli::Util::juli_repo, Juli::REPO, 'config')
  hash  = File.exist?(path) ?
      YAML::load(ERB.new(File.read(path)).result) :
      {}

  hash = {} if hash == false      # YAML::load('') returns false so that set empty hash
  hash = {} if hash.nil?
  @conf = DEFAULT.dup.merge(hash)
end

Instance Attribute Details

#confObject (readonly)

Returns the value of attribute conf.



141
142
143
# File 'lib/juli/util.rb', line 141

def conf
  @conf
end