Class: Jekyll::Graph::PluginConfig
- Inherits:
-
Object
- Object
- Jekyll::Graph::PluginConfig
- Defined in:
- lib/jekyll-graph/config.rb
Constant Summary collapse
- ASSETS_KEY =
"assets"
- ATTRS_KEY =
"attrs"
- CONFIG_KEY =
"graph"
- ENABLED_KEY =
"enabled"
- EXCLUDE_KEY =
"exclude"
- LINKS_KEY =
"links"
- NET_WEB_KEY =
deprecated: ‘net_web’ -> ‘web’
"net_web"
- PATH_KEY =
"path"
- SCRIPTS_KEY =
"scripts"
- TREE_KEY =
"tree"
- WEB_KEY =
"web"
Instance Method Summary collapse
-
#baseurl ⇒ Object
attrs.
-
#disabled? ⇒ Boolean
descriptors.
-
#disabled_net_web? ⇒ Boolean
deprecated: ‘net_web’ -> ‘web’.
- #disabled_tree? ⇒ Boolean
- #disabled_web? ⇒ Boolean
- #excluded?(type) ⇒ Boolean
- #has_custom_assets_path? ⇒ Boolean
- #has_custom_scripts_path? ⇒ Boolean
-
#initialize(config) ⇒ PluginConfig
constructor
A new instance of PluginConfig.
-
#option(key) ⇒ Object
options.
- #option_path(key) ⇒ Object
- #option_tree(key) ⇒ Object
- #option_web(key) ⇒ Object
- #option_web_exclude(key) ⇒ Object
- #path_assets ⇒ Object
- #path_scripts ⇒ Object
- #testing ⇒ Object
- #use_attrs? ⇒ Boolean
- #use_links? ⇒ Boolean
Constructor Details
#initialize(config) ⇒ PluginConfig
Returns a new instance of PluginConfig.
21 22 23 24 25 |
# File 'lib/jekyll-graph/config.rb', line 21 def initialize(config) @config ||= config @testing ||= config['testing'] if config.keys.include?('testing') Jekyll.logger.debug("Excluded jekyll types in graph: ", option(EXCLUDE_KEY)) unless disabled? end |
Instance Method Details
#baseurl ⇒ Object
attrs
109 110 111 |
# File 'lib/jekyll-graph/config.rb', line 109 def baseurl return @config['baseurl'] end |
#disabled? ⇒ Boolean
descriptors
29 30 31 |
# File 'lib/jekyll-graph/config.rb', line 29 def disabled? return option(ENABLED_KEY) == false end |
#disabled_net_web? ⇒ Boolean
deprecated: ‘net_web’ -> ‘web’
38 39 40 |
# File 'lib/jekyll-graph/config.rb', line 38 def disabled_net_web? return option_web(ENABLED_KEY) == false end |
#disabled_tree? ⇒ Boolean
33 34 35 |
# File 'lib/jekyll-graph/config.rb', line 33 def disabled_tree? return option_tree(ENABLED_KEY) == false end |
#disabled_web? ⇒ Boolean
42 43 44 |
# File 'lib/jekyll-graph/config.rb', line 42 def disabled_web? option_web(ENABLED_KEY) == false end |
#excluded?(type) ⇒ Boolean
46 47 48 49 |
# File 'lib/jekyll-graph/config.rb', line 46 def excluded?(type) return false unless option(EXCLUDE_KEY) return option(EXCLUDE_KEY).include?(type.to_s) end |
#has_custom_assets_path? ⇒ Boolean
51 52 53 |
# File 'lib/jekyll-graph/config.rb', line 51 def has_custom_assets_path? return option_path(ASSETS_KEY) end |
#has_custom_scripts_path? ⇒ Boolean
55 56 57 |
# File 'lib/jekyll-graph/config.rb', line 55 def has_custom_scripts_path? return option_path(SCRIPTS_KEY) end |
#option(key) ⇒ Object
options
71 72 73 |
# File 'lib/jekyll-graph/config.rb', line 71 def option(key) @config[CONFIG_KEY] && @config[CONFIG_KEY][key] end |
#option_path(key) ⇒ Object
75 76 77 |
# File 'lib/jekyll-graph/config.rb', line 75 def option_path(key) @config[CONFIG_KEY] && @config[CONFIG_KEY][PATH_KEY] && @config[CONFIG_KEY][PATH_KEY][key] end |
#option_tree(key) ⇒ Object
103 104 105 |
# File 'lib/jekyll-graph/config.rb', line 103 def option_tree(key) @config[CONFIG_KEY] && @config[CONFIG_KEY][TREE_KEY] && @config[CONFIG_KEY][TREE_KEY][key] end |
#option_web(key) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/jekyll-graph/config.rb', line 79 def option_web(key) if @config[CONFIG_KEY] # deprecated: 'net_web' -> 'web' if @config[CONFIG_KEY][NET_WEB_KEY] return @config[CONFIG_KEY][NET_WEB_KEY][key] end if @config[CONFIG_KEY][WEB_KEY] return @config[CONFIG_KEY][WEB_KEY][key] end end end |
#option_web_exclude(key) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/jekyll-graph/config.rb', line 91 def option_web_exclude(key) if @config[CONFIG_KEY] # deprecated: 'net_web' -> 'web' if @config[CONFIG_KEY][NET_WEB_KEY] && @config[CONFIG_KEY][NET_WEB_KEY][EXCLUDE_KEY] return @config[CONFIG_KEY][NET_WEB_KEY][EXCLUDE_KEY][key] end if @config[CONFIG_KEY][WEB_KEY]&& @config[CONFIG_KEY][WEB_KEY][EXCLUDE_KEY] return @config[CONFIG_KEY][WEB_KEY][EXCLUDE_KEY][key] end end end |
#path_assets ⇒ Object
113 114 115 |
# File 'lib/jekyll-graph/config.rb', line 113 def path_assets return has_custom_assets_path? ? option_path(ASSETS_KEY) : "/assets" end |
#path_scripts ⇒ Object
117 118 119 |
# File 'lib/jekyll-graph/config.rb', line 117 def path_scripts return has_custom_scripts_path? ? File.join(path_assets, option_path(SCRIPTS_KEY)) : File.join(path_assets, "js") end |
#testing ⇒ Object
121 122 123 |
# File 'lib/jekyll-graph/config.rb', line 121 def testing return @testing end |