module Jekyll::Favicon::Utils::Configuration::Compact
Favicon
configuration compact logic
Public Class Methods
compact_array(array)
click to toggle source
# File lib/jekyll/favicon/utils/configuration/compact.rb, line 30 def self.compact_array(array) compacted_array = array.each_with_object([]) do |value, memo| next unless (compacted = compact_deep(value)) memo << compacted end compact_shallow compacted_array end
compact_deep(compactable)
click to toggle source
# File lib/jekyll/favicon/utils/configuration/compact.rb, line 13 def self.compact_deep(compactable) case compactable when Hash then compact_hash compactable when Array then compact_array compactable else compactable end end
compact_hash(hash)
click to toggle source
# File lib/jekyll/favicon/utils/configuration/compact.rb, line 21 def self.compact_hash(hash) compacted_hash = hash.each_with_object({}) do |(key, value), memo| next unless (compacted = compact_deep(value)) memo[key] = compacted end compact_shallow compacted_hash end
compact_shallow(compactable)
click to toggle source
# File lib/jekyll/favicon/utils/configuration/compact.rb, line 39 def self.compact_shallow(compactable) compactable.empty? ? nil : compactable.compact end
included(klass)
click to toggle source
# File lib/jekyll/favicon/utils/configuration/compact.rb, line 9 def self.included(klass) klass.extend(ClassMethods) end