class Jekyll::Favicon::StaticFile

Class for static files from with spec dictionary Modify source from spec source Enable tags from spec tags Enable refer

Attributes

site[R]
spec[R]

Public Class Methods

new(site, spec = {}) click to toggle source
Calls superclass method
# File lib/jekyll/favicon/static_file.rb, line 25
def initialize(site, spec = {})
  raise StandardError unless spec.include? "name"

  @spec = spec
  spec_dir, spec_name = File.split spec_relative_path
  super site, site.source, spec_dir, spec_name
end

Public Instance Methods

generable?() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 33
def generable?
  sourceable?
end
href() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 45
def href
  Pathname.new("/")
    .join(*[site.baseurl, url].compact)
    .to_s
end
patch(configuration) click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 41
def patch(configuration)
  taggable_patch spec_patch configuration
end
taggable?() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 37
def taggable?
  generable? && super
end

Private Instance Methods

site_background() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 68
def site_background
  site_configuration.fetch("background", "transparent")
end
site_configuration() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 72
def site_configuration
  Configuration.merged site
end
site_dir() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 64
def site_dir
  site_configuration.fetch("dir", ".")
end
spec_dir_name() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 91
def spec_dir_name
  spec.values_at("dir", "name")
    .compact
end
spec_patch(configuration) click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 53
def spec_patch(configuration)
  Utils.patch configuration do |value|
    case value
    when :site_dir then site_dir
    when :background then site_background
    when :href then href
    else value
    end
  end
end
spec_pathname() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 86
def spec_pathname
  Pathname.new(site_dir)
    .join(*spec_dir_name)
end
spec_relative_path() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 76
def spec_relative_path
  spec_relative_pathname.cleanpath
end
spec_relative_pathname() click to toggle source
# File lib/jekyll/favicon/static_file.rb, line 80
def spec_relative_pathname
  return spec_pathname if spec_pathname.relative?

  pathname.relative_path_from "/"
end