Class: MarkdownRecord::Configuration
- Inherits:
-
Object
- Object
- MarkdownRecord::Configuration
- Includes:
- Singleton
- Defined in:
- lib/markdown_record/configuration.rb
Constant Summary collapse
- RENDER_STRATEGIES =
[:full, :directory, :file]
Instance Attribute Summary collapse
-
#always_concatenate_json ⇒ Object
Returns the value of attribute always_concatenate_json.
-
#concatenated_layout_path ⇒ Object
Returns the value of attribute concatenated_layout_path.
-
#content_root ⇒ Object
Returns the value of attribute content_root.
-
#content_routes ⇒ Object
Returns the value of attribute content_routes.
-
#file_layout_path ⇒ Object
Returns the value of attribute file_layout_path.
-
#filename_sorter ⇒ Object
Returns the value of attribute filename_sorter.
-
#global_layout_path ⇒ Object
Returns the value of attribute global_layout_path.
-
#html_render_options ⇒ Object
Returns the value of attribute html_render_options.
-
#html_routes ⇒ Object
Returns the value of attribute html_routes.
-
#ignore_numeric_prefix ⇒ Object
Returns the value of attribute ignore_numeric_prefix.
-
#json_routes ⇒ Object
Returns the value of attribute json_routes.
-
#layout_directory ⇒ Object
Returns the value of attribute layout_directory.
-
#markdown_extensions ⇒ Object
Returns the value of attribute markdown_extensions.
-
#mount_path ⇒ Object
Returns the value of attribute mount_path.
-
#public_layout ⇒ Object
Returns the value of attribute public_layout.
-
#render_content_fragment_json ⇒ Object
Returns the value of attribute render_content_fragment_json.
-
#render_controller ⇒ Object
Returns the value of attribute render_controller.
-
#render_strategy ⇒ Object
Returns the value of attribute render_strategy.
-
#rendered_content_root ⇒ Object
Returns the value of attribute rendered_content_root.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #render_strategy_options(strategy = nil) ⇒ Object
- #routing ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/markdown_record/configuration.rb', line 27 def initialize @content_root = Rails.root.join("markdown_record","content") @rendered_content_root = Rails.root.join("markdown_record","rendered") @layout_directory = Rails.root.join("markdown_record","layouts") @html_render_options = {} @markdown_extensions = { :fenced_code_blocks => true, :disable_indented_code_blocks => true, :no_intra_emphasis => true} @concatenated_layout_path = "_concatenated_layout.html.erb" @file_layout_path = "_file_layout.html.erb" @global_layout_path = "_global_layout.html.erb" @public_layout = "layouts/application" @render_strategy = :full @always_concatenate_json = true @html_routes = [:show] @json_routes = [:show] @content_routes = [:show] @mount_path = "mdr" @render_content_fragment_json = true @render_controller = nil @ignore_numeric_prefix = true @filename_sorter = MarkdownRecord::FileSorting::Base.new end |
Instance Attribute Details
#always_concatenate_json ⇒ Object
Returns the value of attribute always_concatenate_json.
23 24 25 |
# File 'lib/markdown_record/configuration.rb', line 23 def always_concatenate_json @always_concatenate_json end |
#concatenated_layout_path ⇒ Object
Returns the value of attribute concatenated_layout_path.
8 9 10 |
# File 'lib/markdown_record/configuration.rb', line 8 def concatenated_layout_path @concatenated_layout_path end |
#content_root ⇒ Object
Returns the value of attribute content_root.
5 6 7 |
# File 'lib/markdown_record/configuration.rb', line 5 def content_root @content_root end |
#content_routes ⇒ Object
Returns the value of attribute content_routes.
17 18 19 |
# File 'lib/markdown_record/configuration.rb', line 17 def content_routes @content_routes end |
#file_layout_path ⇒ Object
Returns the value of attribute file_layout_path.
9 10 11 |
# File 'lib/markdown_record/configuration.rb', line 9 def file_layout_path @file_layout_path end |
#filename_sorter ⇒ Object
Returns the value of attribute filename_sorter.
22 23 24 |
# File 'lib/markdown_record/configuration.rb', line 22 def filename_sorter @filename_sorter end |
#global_layout_path ⇒ Object
Returns the value of attribute global_layout_path.
10 11 12 |
# File 'lib/markdown_record/configuration.rb', line 10 def global_layout_path @global_layout_path end |
#html_render_options ⇒ Object
Returns the value of attribute html_render_options.
12 13 14 |
# File 'lib/markdown_record/configuration.rb', line 12 def @html_render_options end |
#html_routes ⇒ Object
Returns the value of attribute html_routes.
15 16 17 |
# File 'lib/markdown_record/configuration.rb', line 15 def html_routes @html_routes end |
#ignore_numeric_prefix ⇒ Object
Returns the value of attribute ignore_numeric_prefix.
21 22 23 |
# File 'lib/markdown_record/configuration.rb', line 21 def ignore_numeric_prefix @ignore_numeric_prefix end |
#json_routes ⇒ Object
Returns the value of attribute json_routes.
16 17 18 |
# File 'lib/markdown_record/configuration.rb', line 16 def json_routes @json_routes end |
#layout_directory ⇒ Object
Returns the value of attribute layout_directory.
7 8 9 |
# File 'lib/markdown_record/configuration.rb', line 7 def layout_directory @layout_directory end |
#markdown_extensions ⇒ Object
Returns the value of attribute markdown_extensions.
11 12 13 |
# File 'lib/markdown_record/configuration.rb', line 11 def markdown_extensions @markdown_extensions end |
#mount_path ⇒ Object
Returns the value of attribute mount_path.
18 19 20 |
# File 'lib/markdown_record/configuration.rb', line 18 def mount_path @mount_path end |
#public_layout ⇒ Object
Returns the value of attribute public_layout.
13 14 15 |
# File 'lib/markdown_record/configuration.rb', line 13 def public_layout @public_layout end |
#render_content_fragment_json ⇒ Object
Returns the value of attribute render_content_fragment_json.
19 20 21 |
# File 'lib/markdown_record/configuration.rb', line 19 def render_content_fragment_json @render_content_fragment_json end |
#render_controller ⇒ Object
Returns the value of attribute render_controller.
20 21 22 |
# File 'lib/markdown_record/configuration.rb', line 20 def render_controller @render_controller end |
#render_strategy ⇒ Object
Returns the value of attribute render_strategy.
14 15 16 |
# File 'lib/markdown_record/configuration.rb', line 14 def render_strategy @render_strategy end |
#rendered_content_root ⇒ Object
Returns the value of attribute rendered_content_root.
6 7 8 |
# File 'lib/markdown_record/configuration.rb', line 6 def rendered_content_root @rendered_content_root end |
Instance Method Details
#render_strategy_options(strategy = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/markdown_record/configuration.rb', line 49 def (strategy = nil) strat = strategy || @render_strategy unless RENDER_STRATEGIES.include?(strat) raise ::ArgumentError.new("Invalide render strategy.") end case strategy || @render_strategy when :full {:concat => true, :deep => true} when :directory {:concat => true, :deep => false} when :file {:concat => false, :deep => true} end end |
#routing ⇒ Object
66 67 68 |
# File 'lib/markdown_record/configuration.rb', line 66 def routing { :html => html_routes, :json => json_routes, :content => content_routes} end |