Class: Logi::Config
- Inherits:
-
Struct
- Object
- Struct
- Logi::Config
- Defined in:
- lib/logi/config.rb
Instance Attribute Summary collapse
-
#default_layout ⇒ Object
Returns the value of attribute default_layout.
-
#layout_path ⇒ Object
Returns the value of attribute layout_path.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#post_path ⇒ Object
Returns the value of attribute post_path.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #layout_path_for(post) ⇒ Object
- #output_path_for(post) ⇒ Object
- #path ⇒ Object
- #post_path_for(post) ⇒ Object
- #posts ⇒ Object
- #root ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
10 11 12 13 |
# File 'lib/logi/config.rb', line 10 def initialize ={} = Logi::Loader.new(self).load if File.exist?(path) end |
Instance Attribute Details
#default_layout ⇒ Object
Returns the value of attribute default_layout
6 7 8 |
# File 'lib/logi/config.rb', line 6 def default_layout @default_layout end |
#layout_path ⇒ Object
Returns the value of attribute layout_path
6 7 8 |
# File 'lib/logi/config.rb', line 6 def layout_path @layout_path end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/logi/config.rb', line 8 def end |
#output_path ⇒ Object
Returns the value of attribute output_path
6 7 8 |
# File 'lib/logi/config.rb', line 6 def output_path @output_path end |
#post_path ⇒ Object
Returns the value of attribute post_path
6 7 8 |
# File 'lib/logi/config.rb', line 6 def post_path @post_path end |
Instance Method Details
#layout_path_for(post) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/logi/config.rb', line 31 def layout_path_for post if layout = post.[:layout] || default_layout "#{root}/#{layout_path}/#{layout}" else Logi::Default.default_layout end end |
#output_path_for(post) ⇒ Object
39 40 41 |
# File 'lib/logi/config.rb', line 39 def output_path_for post "#{root}/#{output_path}/#{post.path.sub(/\..+$/, '')}.html" end |
#path ⇒ Object
23 24 25 |
# File 'lib/logi/config.rb', line 23 def path "#{root}/config/logi.rb" end |
#post_path_for(post) ⇒ Object
27 28 29 |
# File 'lib/logi/config.rb', line 27 def post_path_for post "#{root}/#{post_path}/#{post.path}" end |
#posts ⇒ Object
15 16 17 |
# File 'lib/logi/config.rb', line 15 def posts @posts ||= {} end |
#root ⇒ Object
19 20 21 |
# File 'lib/logi/config.rb', line 19 def root File.([:root] || Logi::Default.default_root_path) end |