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.
Class Method Summary collapse
- .default_command ⇒ Object
- .default_layout ⇒ Object
- .default_layout_path ⇒ Object
- .default_output_path ⇒ Object
- .default_post_path ⇒ Object
- .default_root_path ⇒ Object
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
Instance Attribute Details
#default_layout ⇒ Object
Returns the value of attribute default_layout
5 6 7 |
# File 'lib/logi/config.rb', line 5 def default_layout @default_layout end |
#layout_path ⇒ Object
Returns the value of attribute layout_path
5 6 7 |
# File 'lib/logi/config.rb', line 5 def layout_path @layout_path end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/logi/config.rb', line 16 def @options end |
#output_path ⇒ Object
Returns the value of attribute output_path
5 6 7 |
# File 'lib/logi/config.rb', line 5 def output_path @output_path end |
#post_path ⇒ Object
Returns the value of attribute post_path
5 6 7 |
# File 'lib/logi/config.rb', line 5 def post_path @post_path end |
Class Method Details
.default_command ⇒ Object
11 |
# File 'lib/logi/config.rb', line 11 def self.default_command ; 'post' ; end |
.default_layout ⇒ Object
12 13 14 |
# File 'lib/logi/config.rb', line 12 def self.default_layout File.("#{__dir__}/layout/default.html.erb") end |
.default_layout_path ⇒ Object
9 |
# File 'lib/logi/config.rb', line 9 def self.default_layout_path; 'layout'; end |
.default_output_path ⇒ Object
10 |
# File 'lib/logi/config.rb', line 10 def self.default_output_path; 'public'; end |
.default_post_path ⇒ Object
8 |
# File 'lib/logi/config.rb', line 8 def self.default_post_path ; 'post' ; end |
.default_root_path ⇒ Object
7 |
# File 'lib/logi/config.rb', line 7 def self.default_root_path ; '.' ; end |
Instance Method Details
#layout_path_for(post) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/logi/config.rb', line 39 def layout_path_for post if layout = post.[:layout] || default_layout "#{root}/#{layout_path}/#{layout}" else self.class.default_layout end end |
#output_path_for(post) ⇒ Object
47 48 49 |
# File 'lib/logi/config.rb', line 47 def output_path_for post "#{root}/#{output_path}/#{post.path.sub(/\..+$/, '')}.html" end |
#path ⇒ Object
31 32 33 |
# File 'lib/logi/config.rb', line 31 def path "#{root}/config/logi.rb" end |
#post_path_for(post) ⇒ Object
35 36 37 |
# File 'lib/logi/config.rb', line 35 def post_path_for post "#{root}/#{post_path}/#{post.path}" end |
#posts ⇒ Object
23 24 25 |
# File 'lib/logi/config.rb', line 23 def posts @posts ||= {} end |
#root ⇒ Object
27 28 29 |
# File 'lib/logi/config.rb', line 27 def root [:root] || self.class.default_root_path end |