Class: Jekyll::RpLogs::TagImplicationHandler
- Inherits:
-
Object
- Object
- Jekyll::RpLogs::TagImplicationHandler
- Defined in:
- lib/jekyll/rp_logs/rp_tag_implication_handler.rb
Defined Under Namespace
Classes: TagImplicationError
Instance Attribute Summary collapse
-
#tag_aliases ⇒ Object
readonly
Returns the value of attribute tag_aliases.
-
#tag_implications ⇒ Object
readonly
Returns the value of attribute tag_implications.
Instance Method Summary collapse
-
#initialize(config) ⇒ TagImplicationHandler
constructor
Extract global settings from the config file.
- #update_tags(tag_set, verbose: false) ⇒ Object
Constructor Details
#initialize(config) ⇒ TagImplicationHandler
Extract global settings from the config file.
11 12 13 14 15 |
# File 'lib/jekyll/rp_logs/rp_tag_implication_handler.rb', line 11 def initialize(config) @tag_implications = (config["tag_implications"] || {}).freeze @tag_aliases = (config["tag_aliases"] || {}).freeze validate_tag_rules end |
Instance Attribute Details
#tag_aliases ⇒ Object (readonly)
Returns the value of attribute tag_aliases.
7 8 9 |
# File 'lib/jekyll/rp_logs/rp_tag_implication_handler.rb', line 7 def tag_aliases @tag_aliases end |
#tag_implications ⇒ Object (readonly)
Returns the value of attribute tag_implications.
7 8 9 |
# File 'lib/jekyll/rp_logs/rp_tag_implication_handler.rb', line 7 def tag_implications @tag_implications end |
Instance Method Details
#update_tags(tag_set, verbose: false) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jekyll/rp_logs/rp_tag_implication_handler.rb', line 17 def (tag_set, verbose: false) = Set.new loop do = tag_set.clone cyclical = catch :cyclical_tags do (tag_set, , verbose) (tag_set, ) false end if cyclical fail_with "The tag #{cyclical[1]} (from #{cyclical[0]} => #{cyclical[1]}) has been removed before. There is a cycle in the tag aliases and implications." end # Break when there is no change in tags. return tag_set if tag_set == end end |