class Jekyll::Site

Attributes

constants_file[RW]

Public Instance Methods

constants_file_path() click to toggle source
# File lib/jekyll_constant_values.rb, line 21
def constants_file_path
  # Check if a custom name for constants file is defined
  if config['constants'].nil?
    '_data/constants.yml' # Default constants file
  else
    '_data/' + config['constants'] + '.yml' # Custom constants file
  end
end
process() click to toggle source
# File lib/jekyll_constant_values.rb, line 8
def process
  # Get the constants file path
  const_file = constants_file_path
  # Exit the process if not valid file
  exit unless valid_file?(const_file)
  # Assign the path if valid
  self.constants_file ||= const_file
  # Show info message
  puts "Using file #{const_file} for constant values"

  process_constants
end
Also aliased as: process_constants
process_constants()
Alias for: process
valid_file?(const_file) click to toggle source
# File lib/jekyll_constant_values.rb, line 30
def valid_file?(const_file)
  # Check if the constants file exist
  unless File.exist?(const_file)
    puts "No such file or directory #{const_file}"
    return false
  end
  true
end