code
stringlengths
26
124k
docstring
stringlengths
23
125k
func_name
stringlengths
1
98
language
stringclasses
1 value
repo
stringlengths
5
53
path
stringlengths
7
151
url
stringlengths
50
211
license
stringclasses
7 values
def respond_to_missing?(method, include_private = false) docs.respond_to?(method.to_sym, include_private) || super end
Override of normal respond_to? to match method_missing's logic for looking in @data.
respond_to_missing?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def method_missing(method, *args, &blck) if docs.respond_to?(method.to_sym) Jekyll.logger.warn "Deprecation:", "#{label}.#{method} should be changed to #{label}.docs.#{method}." Jekyll.logger.warn "", "Called by #{caller(0..0)}." docs.public_send(method.to_sym, *args, &blck) else super end end
Override of method_missing to check in @data for the key.
method_missing
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def files @files ||= [] end
Fetch the static files in this collection. Defaults to an empty array if no static files have been read in. Returns an array of Jekyll::StaticFile objects.
files
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def read filtered_entries.each do |file_path| full_path = collection_dir(file_path) next if File.directory?(full_path) if Utils.has_yaml_header? full_path read_document(full_path) else read_static_file(file_path, full_path) end end docs.sort! end
Read the allowed documents into the collection's array of docs. Returns the sorted array of docs.
read
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def entries return [] unless exists? @entries ||= Utils.safe_glob(collection_dir, ["**", "*"], File::FNM_DOTMATCH).map do |entry| entry["#{collection_dir}/"] = "" entry end end
All the entries in this collection. Returns an Array of file paths to the documents in this collection relative to the collection's directory
entries
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def filtered_entries return [] unless exists? @filtered_entries ||= Dir.chdir(directory) do entry_filter.filter(entries).reject do |f| path = collection_dir(f) File.directory?(path) || entry_filter.symlink?(f) end end end
Filtered version of the entries in this collection. See `Jekyll::EntryFilter#filter` for more information. Returns a list of filtered entry paths.
filtered_entries
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def relative_directory @relative_directory ||= "_#{label}" end
The directory for this Collection, relative to the site source or the directory containing the collection. Returns a String containing the directory name where the collection is stored on the filesystem.
relative_directory
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def directory @directory ||= site.in_source_dir( File.join(container, relative_directory) ) end
The full path to the directory containing the collection. Returns a String containing th directory name where the collection is stored on the filesystem.
directory
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def collection_dir(*files) return directory if files.empty? site.in_source_dir(container, relative_directory, *files) end
The full path to the directory containing the collection, with optional subpaths. *files - (optional) any other path pieces relative to the directory to append to the path Returns a String containing th directory name where the collection is stored on the filesystem.
collection_dir
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def exists? File.directory?(directory) && !entry_filter.symlink?(directory) end
Checks whether the directory "exists" for this collection. The directory must exist on the filesystem and must not be a symlink if in safe mode. Returns false if the directory doesn't exist or if it's a symlink and we're in safe mode.
exists?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def entry_filter @entry_filter ||= Jekyll::EntryFilter.new(site, relative_directory) end
The entry filter for this collection. Creates an instance of Jekyll::EntryFilter. Returns the instance of Jekyll::EntryFilter for this collection.
entry_filter
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def inspect "#<Jekyll::Collection @label=#{label} docs=#{docs}>" end
An inspect string. Returns the inspect string
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def sanitize_label(label) label.gsub(%r![^a-z0-9_\-\.]!i, "") end
Produce a sanitized label name Label names may not contain anything but alphanumeric characters, underscores, and hyphens. label - the possibly-unsafe label Returns a sanitized version of the label.
sanitize_label
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def to_liquid Drops::CollectionDrop.new self end
Produce a representation of this Collection for use in Liquid. Exposes two attributes: - label - docs Returns a representation of this collection for use in Liquid.
to_liquid
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def write? !!metadata.fetch("output", false) end
Whether the collection's documents ought to be written as individual files in the output. Returns true if the 'write' metadata is true, false otherwise.
write?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def url_template @url_template ||= metadata.fetch("permalink") do Utils.add_permalink_suffix("/:collection/:path", site.permalink_style) end end
The URL template to render collection's documents at. Returns the URL template to render collection's documents at.
url_template
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def extract_metadata if site.config["collections"].is_a?(Hash) site.config["collections"][label] || {} else {} end end
Extract options for this collection from the site configuration. Returns the metadata for this collection
extract_metadata
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/collection.rb
Apache-2.0
def subclasses @subclasses ||= [] end
A list of subclasses of Jekyll::Command
subclasses
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
Apache-2.0
def inherited(base) subclasses << base super(base) end
Keep a list of subclasses of Jekyll::Command every time it's inherited Called automatically. base - the subclass Returns nothing
inherited
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
Apache-2.0
def process_site(site) site.process rescue Jekyll::Errors::FatalException => e Jekyll.logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:" Jekyll.logger.error "", "------------------------------------" Jekyll.logger.error "", e.message exit(1) end
Run Site#process and catch errors site - the Jekyll::Site object Returns nothing
process_site
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
Apache-2.0
def configuration_from_options(options) return options if options.is_a?(Jekyll::Configuration) Jekyll.configuration(options) end
Create a full Jekyll configuration with the options passed in as overrides options - the configuration overrides Returns a full Jekyll configuration
configuration_from_options
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
Apache-2.0
def add_build_options(cmd) cmd.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array, "Custom configuration file" cmd.option "destination", "-d", "--destination DESTINATION", "The current folder will be generated into DESTINATION" cmd.option "source", "-s", "--source SOURCE", "Custom source directory" cmd.option "future", "--future", "Publishes posts with a future date" cmd.option "limit_posts", "--limit_posts MAX_POSTS", Integer, "Limits the number of posts to parse and publish" cmd.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild" cmd.option "baseurl", "-b", "--baseurl URL", "Serve the website from the given base URL" cmd.option "force_polling", "--force_polling", "Force watch to use polling" cmd.option "lsi", "--lsi", "Use LSI for improved related posts" cmd.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder" cmd.option "unpublished", "--unpublished", "Render posts that were marked as unpublished" cmd.option "quiet", "-q", "--quiet", "Silence output." cmd.option "verbose", "-V", "--verbose", "Print verbose output." cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild." cmd.option "strict_front_matter", "--strict_front_matter", "Fail if errors are present in front matter" end
Add common options to a command for building configuration cmd - the Jekyll::Command to add these options to Returns nothing rubocop:disable Metrics/MethodLength
add_build_options
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/command.rb
Apache-2.0
def from(user_config) Utils.deep_merge_hashes(DEFAULTS, Configuration[user_config].stringify_keys) .add_default_collections end
Static: Produce a Configuration ready for use in a Site. It takes the input, fills in the defaults where values do not exist, and patches common issues including migrating options for backwards compatiblity. Except where a key or value is being fixed, the user configuration will override the defaults. user_config - a Hash or Configuration of overrides. Returns a Configuration filled with defaults and fixed for common problems and backwards-compatibility.
from
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
Apache-2.0
def stringify_keys reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) } end
Public: Turn all keys into string Return a copy of the hash where all its keys are strings
stringify_keys
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
Apache-2.0
def source(override) get_config_value_with_override("source", override) end
Public: Directory of the Jekyll source folder override - the command-line options hash Returns the path to the Jekyll source directory
source
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
Apache-2.0
def config_files(override) # Adjust verbosity quickly Jekyll.logger.adjust_verbosity( :quiet => quiet?(override), :verbose => verbose?(override) ) # Get configuration from <source>/_config.yml or <source>/<config_file> config_files = override["config"] if config_files.to_s.empty? default = %w(yml yaml).find(-> { "yml" }) do |ext| File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}")) end config_files = Jekyll.sanitized_path(source(override), "_config.#{default}") @default_config_file = true end Array(config_files) end
Public: Generate list of configuration files from the override override - the command-line options hash Returns an Array of config files
config_files
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
Apache-2.0
def read_config_file(file) next_config = safe_load_file(file) check_config_is_hash!(next_config, file) Jekyll.logger.info "Configuration file:", file next_config rescue SystemCallError if @default_config_file ||= nil Jekyll.logger.warn "Configuration file:", "none" {} else Jekyll.logger.error "Fatal:", "The configuration file '#{file}' could not be found." raise LoadError, "The Configuration file '#{file}' could not be found." end end
Public: Read configuration and return merged Hash file - the path to the YAML file to be read in Returns this configuration, overridden by the values in the file
read_config_file
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
Apache-2.0
def read_config_files(files) configuration = clone begin files.each do |config_file| next if config_file.nil? || config_file.empty? new_config = read_config_file(config_file) configuration = Utils.deep_merge_hashes(configuration, new_config) end rescue ArgumentError => err Jekyll.logger.warn "WARNING:", "Error reading configuration. " \ "Using defaults (and options)." warn err end configuration.backwards_compatibilize.add_default_collections end
Public: Read in a list of configuration files and merge with this hash files - the list of configuration file paths Returns the full configuration, with the defaults overridden by the values in the configuration files
read_config_files
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
Apache-2.0
def backwards_compatibilize config = clone # Provide backwards-compatibility check_auto(config) check_server(config) check_plugins(config) renamed_key "server_port", "port", config renamed_key "gems", "plugins", config renamed_key "layouts", "layouts_dir", config renamed_key "data_source", "data_dir", config check_pygments(config) check_include_exclude(config) check_coderay(config) check_maruku(config) config end
Public: Ensure the proper options are set in the configuration to allow for backwards-compatibility with Jekyll pre-1.0 Returns the backwards-compatible configuration
backwards_compatibilize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb
Apache-2.0
def initialize(config = {}) @config = config end
Initialize the converter. Returns an initialized Converter.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/converter.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/converter.rb
Apache-2.0
def published? !(data.key?("published") && data["published"] == false) end
Whether the file is published or not, as indicated in YAML front-matter
published?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def read_yaml(base, name, opts = {}) filename = File.join(base, name) begin self.content = File.read(@path || site.in_source_dir(base, name), **Utils.merged_file_read_opts(site, opts)) if content =~ Document::YAML_FRONT_MATTER_REGEXP self.content = $POSTMATCH self.data = SafeYAML.load(Regexp.last_match(1)) end rescue Psych::SyntaxError => e Jekyll.logger.warn "YAML Exception reading #{filename}: #{e.message}" raise e if self.site.config["strict_front_matter"] rescue StandardError => e Jekyll.logger.warn "Error reading file #{filename}: #{e.message}" raise e if self.site.config["strict_front_matter"] end self.data ||= {} validate_data! filename validate_permalink! filename self.data end
Read the YAML frontmatter. base - The String path to the dir containing the file. name - The String filename of the file. opts - optional parameter to File.read, default at site configs Returns nothing. rubocop:disable Metrics/AbcSize
read_yaml
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def render_liquid(content, payload, info, path) _renderer.render_liquid(content, payload, info, path) end
Render Liquid in the content content - the raw Liquid content to render payload - the payload for Liquid info - the info for Liquid Returns the converted content
render_liquid
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def to_liquid(attrs = nil) further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map do |attribute| [attribute, send(attribute)] end] defaults = site.frontmatter_defaults.all(relative_path, type) Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data) end
Convert this Convertible's data to a Hash suitable for use by Liquid. Returns the Hash representation of this Convertible.
to_liquid
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def type if is_a?(Page) :pages end end
The type of a document, i.e., its classname downcase'd and to_sym'd. Returns the type of self.
type
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def hook_owner if is_a?(Page) :pages end end
returns the owner symbol for hook triggering
hook_owner
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def asset_file? sass_file? || coffeescript_file? end
Determine whether the document is an asset file. Asset files include CoffeeScript files and Sass/SCSS files. Returns true if the extname belongs to the set of extensions that asset files use.
asset_file?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def sass_file? %w(.sass .scss).include?(ext) end
Determine whether the document is a Sass file. Returns true if extname == .sass or .scss, false otherwise.
sass_file?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def coffeescript_file? ext == ".coffee" end
Determine whether the document is a CoffeeScript file. Returns true if extname == .coffee, false otherwise.
coffeescript_file?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def place_in_layout? !(asset_file? || no_layout?) end
Determine whether the file should be placed into layouts. Returns false if the document is an asset file or if the front matter specifies `layout: none`
place_in_layout?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def invalid_layout?(layout) !data["layout"].nil? && layout.nil? && !(self.is_a? Jekyll::Excerpt) end
Checks if the layout specified in the document actually exists layout - the layout to check Returns true if the layout is invalid, false if otherwise
invalid_layout?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def render_all_layouts(layouts, payload, info) _renderer.layouts = layouts self.output = _renderer.place_in_layouts(output, payload, info) ensure @_renderer = nil # this will allow the modifications above to disappear end
Recursively render layouts layouts - a list of the layouts payload - the payload for Liquid info - the info for Liquid Returns nothing
render_all_layouts
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def do_layout(payload, layouts) self.output = _renderer.tap do |renderer| renderer.layouts = layouts renderer.payload = payload end.run Jekyll.logger.debug "Post-Render Hooks:", self.relative_path Jekyll::Hooks.trigger hook_owner, :post_render, self ensure @_renderer = nil # this will allow the modifications above to disappear end
Add any necessary layouts to this convertible document. payload - The site payload Drop or Hash. layouts - A Hash of {"name" => "layout"}. Returns nothing.
do_layout
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def write(dest) path = destination(dest) FileUtils.mkdir_p(File.dirname(path)) Jekyll.logger.debug "Writing:", path File.write(path, output, :mode => "wb") Jekyll::Hooks.trigger hook_owner, :post_write, self end
Write the generated page file to the destination directory. dest - The String path to the destination dir. Returns nothing.
write
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/convertible.rb
Apache-2.0
def initialize(path, relations = {}) @site = relations[:site] @path = path @extname = File.extname(path) @collection = relations[:collection] @has_yaml_header = nil if draft? categories_from_path("_drafts") else categories_from_path(collection.relative_directory) end data.default_proc = proc do |_, key| site.frontmatter_defaults.find(relative_path, collection.label, key) end trigger_hooks(:post_init) end
Create a new Document. path - the path to the file relations - a hash with keys :site and :collection, the values of which are the Jekyll::Site and Jekyll::Collection to which this Document belong. Returns nothing.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def data @data ||= {} end
Fetch the Document's data. Returns a Hash containing the data. An empty hash is returned if no data was read.
data
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def merge_data!(other, source: "YAML front matter") merge_categories!(other) Utils.deep_merge_hashes!(data, other) merge_date!(source) data end
Merge some data in with this document's data. Returns the merged data.
merge_data!
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def draft? data["draft"] ||= relative_path.index(collection.relative_directory).nil? && collection.label == "posts" end
Returns whether the document is a draft. This is only the case if the document is in the 'posts' collection but in a different directory than '_posts'. Returns whether the document is a draft.
draft?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def relative_path @relative_path ||= path.sub("#{site.collections_path}/", "") end
The path to the document, relative to the collections_dir. Returns a String path which represents the relative path from the collections_dir to this document.
relative_path
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def output_ext @output_ext ||= Jekyll::Renderer.new(site, self).output_ext end
The output extension of the document. Returns the output extension
output_ext
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def basename_without_ext @basename_without_ext ||= File.basename(path, ".*") end
The base filename of the document, without the file extname. Returns the basename without the file extname.
basename_without_ext
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def basename @basename ||= File.basename(path) end
The base filename of the document. Returns the base filename of the document.
basename
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def cleaned_relative_path @cleaned_relative_path ||= relative_path[0..-extname.length - 1].sub(collection.relative_directory, "") end
Produces a "cleaned" relative path. The "cleaned" relative path is the relative path without the extname and with the collection's directory removed as well. This method is useful when building the URL of the document. Examples: When relative_path is "_methods/site/generate.md": cleaned_relative_path # => "/site/generate" Returns the cleaned relative path of the document.
cleaned_relative_path
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def yaml_file? %w(.yaml .yml).include?(extname) end
Determine whether the document is a YAML file. Returns true if the extname is either .yml or .yaml, false otherwise.
yaml_file?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def asset_file? sass_file? || coffeescript_file? end
Determine whether the document is an asset file. Asset files include CoffeeScript files and Sass/SCSS files. Returns true if the extname belongs to the set of extensions that asset files use.
asset_file?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def sass_file? %w(.sass .scss).include?(extname) end
Determine whether the document is a Sass file. Returns true if extname == .sass or .scss, false otherwise.
sass_file?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def coffeescript_file? extname == ".coffee" end
Determine whether the document is a CoffeeScript file. Returns true if extname == .coffee, false otherwise.
coffeescript_file?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def render_with_liquid? !(coffeescript_file? || yaml_file? || !Utils.has_liquid_construct?(content)) end
Determine whether the file should be rendered with Liquid. Returns false if the document is either an asset file or a yaml file, or if the document doesn't contain any Liquid Tags or Variables, true otherwise.
render_with_liquid?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def no_layout? data["layout"] == "none" end
Determine whether the file should be rendered with a layout. Returns true if the Front Matter specifies that `layout` is set to `none`.
no_layout?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def place_in_layout? !(asset_file? || yaml_file? || no_layout?) end
Determine whether the file should be placed into layouts. Returns false if the document is set to `layouts: none`, or is either an asset file or a yaml file. Returns true otherwise.
place_in_layout?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def url_placeholders @url_placeholders ||= Drops::UrlDrop.new(self) end
Construct a Hash of key-value pairs which contain a mapping between a key in the URL template and the corresponding value for this document. Returns the Hash of key-value pairs for replacement in the URL.
url_placeholders
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def permalink data && data.is_a?(Hash) && data["permalink"] end
The permalink for this Document. Permalink is set via the data Hash. Returns the permalink or nil if no permalink was set in the data.
permalink
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def url @url ||= URL.new({ :template => url_template, :placeholders => url_placeholders, :permalink => permalink, }).to_s end
The computed URL for the document. See `Jekyll::URL#to_s` for more details. Returns the computed URL for the document.
url
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def destination(base_directory) dest = site.in_dest_dir(base_directory) path = site.in_dest_dir(dest, URL.unescape_path(url)) if url.end_with? "/" path = File.join(path, "index.html") else path << output_ext unless path.end_with? output_ext end path end
The full path to the output file. base_directory - the base path of the output directory Returns the full path to the output file of this document.
destination
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def write(dest) path = destination(dest) FileUtils.mkdir_p(File.dirname(path)) Jekyll.logger.debug "Writing:", path File.write(path, output, :mode => "wb") trigger_hooks(:post_write) end
Write the generated Document file to the destination directory. dest - The String path to the destination dir. Returns nothing.
write
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def published? !(data.key?("published") && data["published"] == false) end
Whether the file is published or not, as indicated in YAML front-matter Returns 'false' if the 'published' key is specified in the YAML front-matter and is 'false'. Otherwise returns 'true'.
published?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def read(opts = {}) Jekyll.logger.debug "Reading:", relative_path if yaml_file? @data = SafeYAML.load_file(path) else begin merge_defaults read_content(**opts) read_post_data rescue StandardError => e handle_read_error(e) end end end
Read in the file and assign the content and data based on the file contents. Merge the frontmatter of the file with the frontmatter default values Returns nothing.
read
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def to_liquid @to_liquid ||= Drops::DocumentDrop.new(self) end
Create a Liquid-understandable version of this Document. Returns a Hash representing this Document's data.
to_liquid
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def inspect "#<Jekyll::Document #{relative_path} collection=#{collection.label}>" end
The inspect string for this document. Includes the relative path and the collection label. Returns the inspect string for this document.
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def to_s output || content || "NO CONTENT" end
The string representation for this document. Returns the content of the document
to_s
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def write? collection && collection.write? && site.publisher.publish?(self) end
Determine whether this document should be written. Based on the Collection to which it belongs. True if the document has a collection and if that collection's #write? method returns true, and if the site's Publisher will publish the document. False otherwise.
write?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def excerpt_separator (data["excerpt_separator"] || site.config["excerpt_separator"]).to_s end
The Document excerpt_separator, from the YAML Front-Matter or site default excerpt_separator value Returns the document excerpt_separator
excerpt_separator
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def related_posts @related_posts ||= Jekyll::RelatedPosts.new(self).build end
Calculate related posts. Returns an Array of related Posts.
related_posts
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def respond_to?(method, include_private = false) data.key?(method.to_s) || super end
Override of normal respond_to? to match method_missing's logic for looking in @data.
respond_to?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def method_missing(method, *args, &blck) if data.key?(method.to_s) Jekyll::Deprecator.deprecation_message "Document##{method} is now a key "\ "in the #data hash." Jekyll::Deprecator.deprecation_message "Called by #{caller(0..0)}." data[method.to_s] else super end end
Override of method_missing to check in @data for the key.
method_missing
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def categories_from_path(special_dir) superdirs = relative_path.sub(%r!#{special_dir}(.*)!, "") .split(File::SEPARATOR) .reject do |c| c.empty? || c == special_dir || c == basename end merge_data!({ "categories" => superdirs }, :source => "file path") end
Add superdirectories of the special_dir to categories. In the case of es/_posts, 'es' is added as a category. In the case of _posts/es, 'es' is NOT added as a category. Returns nothing.
categories_from_path
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/document.rb
Apache-2.0
def symlink?(entry) site.safe && File.symlink?(entry) && symlink_outside_site_source?(entry) end
-- Check if a file is a symlink. NOTE: This can be converted to allowing even in safe, since we use Pathutil#in_path? now. --
symlink?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/entry_filter.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/entry_filter.rb
Apache-2.0
def symlink_outside_site_source?(entry) !Pathutil.new(entry).in_path?( site.in_source_dir ) end
-- NOTE: Pathutil#in_path? gets the realpath. @param [<Anything>] entry the entry you want to validate. Check if a path is outside of our given root. --
symlink_outside_site_source?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/entry_filter.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/entry_filter.rb
Apache-2.0
def glob_include?(enum, entry) entry_path = Pathutil.new(site.in_source_dir).join(entry) enum.any? do |exp| # Users who send a Regexp knows what they want to # exclude, so let them send a Regexp to exclude files, # we will not bother caring if it works or not, it's # on them at this point. if exp.is_a?(Regexp) entry_path =~ exp else item = Pathutil.new(site.in_source_dir).join(exp) # If it's a directory they want to exclude, AKA # ends with a "/" then we will go on to check and # see if the entry falls within that path and # exclude it if that's the case. if entry.end_with?("/") entry_path.in_path?( item ) else File.fnmatch?(item, entry_path) || entry_path.to_path.start_with?( item ) end end end end
-- Check if an entry matches a specific pattern and return true,false. Returns true if path matches against any glob pattern. --
glob_include?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/entry_filter.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/entry_filter.rb
Apache-2.0
def initialize(doc) self.doc = doc self.content = extract_excerpt(doc.content) end
Initialize this Excerpt instance. doc - The Document. Returns the new Excerpt.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
Apache-2.0
def data @data ||= doc.data.dup @data.delete("layout") @data.delete("excerpt") @data end
Fetch YAML front-matter data from related doc, without layout key Returns Hash of doc data
data
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
Apache-2.0
def path File.join(doc.path, "#excerpt") end
'Path' of the excerpt. Returns the path for the doc this excerpt belongs to with #excerpt appended
path
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
Apache-2.0
def relative_path File.join(doc.relative_path, "#excerpt") end
'Relative Path' of the excerpt. Returns the relative_path for the doc this excerpt belongs to with #excerpt appended
relative_path
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
Apache-2.0
def include?(something) (output && output.include?(something)) || content.include?(something) end
Check if excerpt includes a string Returns true if the string passed in
include?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
Apache-2.0
def inspect "<Excerpt: #{self.id}>" end
Returns the shorthand String identifier of this doc.
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/excerpt.rb
Apache-2.0
def blessed_gems %w( jekyll-docs jekyll-import ) end
Gems that, if installed, should be loaded. Usually contain subcommands.
blessed_gems
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
Apache-2.0
def require_if_present(names) Array(names).each do |name| begin require name rescue LoadError Jekyll.logger.debug "Couldn't load #{name}. Skipping." yield(name, version_constraint(name)) if block_given? false end end end
Require a gem or file if it's present, otherwise silently fail. names - a string gem name or array of gem names
require_if_present
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
Apache-2.0
def version_constraint(gem_name) return "= #{Jekyll::VERSION}" if gem_name.to_s.eql?("jekyll-docs") "> 0" end
The version constraint required to activate a given gem. Usually the gem version requirement is "> 0," because any version will do. In the case of jekyll-docs, however, we require the exact same version as Jekyll. Returns a String version constraint in a parseable form for RubyGems.
version_constraint
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
Apache-2.0
def require_with_graceful_fail(names) Array(names).each do |name| begin Jekyll.logger.debug "Requiring:", name.to_s require name rescue LoadError => e Jekyll.logger.error "Dependency Error:", <<-MSG Yikes! It looks like you don't have #{name} or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: '#{e.message}' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/! MSG raise Jekyll::Errors::MissingDependencyException, name end end end
Require a gem or gems. If it's not present, show a very nice error message that explains everything and is much more helpful than the normal LoadError. names - a string gem name or array of gem names
require_with_graceful_fail
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/external.rb
Apache-2.0
def markdownify(input) @context.registers[:site].find_converter_instance( Jekyll::Converters::Markdown ).convert(input.to_s) end
Convert a Markdown string into HTML output. input - The Markdown String to convert. Returns the HTML formatted String.
markdownify
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def smartify(input) @context.registers[:site].find_converter_instance( Jekyll::Converters::SmartyPants ).convert(input.to_s) end
Convert quotes into smart quotes. input - The String to convert. Returns the smart-quotified String.
smartify
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def sassify(input) @context.registers[:site].find_converter_instance( Jekyll::Converters::Sass ).convert(input) end
Convert a Sass string into CSS output. input - The Sass String to convert. Returns the CSS formatted String.
sassify
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def scssify(input) @context.registers[:site].find_converter_instance( Jekyll::Converters::Scss ).convert(input) end
Convert a Scss string into CSS output. input - The Scss String to convert. Returns the CSS formatted String.
scssify
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def slugify(input, mode = nil) Utils.slugify(input, :mode => mode) end
Slugify a filename or title. input - The filename or title to slugify. mode - how string is slugified Returns the given filename or title as a lowercase URL String. See Utils.slugify for more detail.
slugify
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def xml_escape(input) input.to_s.encode(:xml => :attr).gsub(%r!\A"|"\Z!, "") end
XML escape a string for use. Replaces any special characters with appropriate HTML entity replacements. input - The String to escape. Examples xml_escape('foo "bar" <baz>') # => "foo &quot;bar&quot; &lt;baz&gt;" Returns the escaped String.
xml_escape
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def normalize_whitespace(input) input.to_s.gsub(%r!\s+!, " ").strip end
Replace any whitespace in the input string with a single space input - The String on which to operate. Returns the formatted String
normalize_whitespace
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def array_to_sentence_string(array, connector = "and") case array.length when 0 "" when 1 array[0].to_s when 2 "#{array[0]} #{connector} #{array[1]}" else "#{array[0...-1].join(", ")}, #{connector} #{array[-1]}" end end
Join an array of things into a string by separating with commas and the word "and" for the last one. array - The Array of Strings to join. connector - Word used to connect the last 2 items in the array Examples array_to_sentence_string(["apples", "oranges", "grapes"]) # => "apples, oranges, and grapes" Returns the formatted String.
array_to_sentence_string
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def where(input, property, value) return input if property.nil? || value.nil? return input unless input.respond_to?(:select) input = input.values if input.is_a?(Hash) input_id = input.hash # implement a hash based on method parameters to cache the end-result # for given parameters. @where_filter_cache ||= {} @where_filter_cache[input_id] ||= {} @where_filter_cache[input_id][property] ||= {} # stash or retrive results to return @where_filter_cache[input_id][property][value] ||= begin input.select do |object| Array(item_property(object, property)).map!(&:to_s).include?(value.to_s) end || [] end end
Filter an array of objects input - the object array property - property within each object to filter by value - desired value Returns the filtered array of objects
where
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def where_exp(input, variable, expression) return input unless input.respond_to?(:select) input = input.values if input.is_a?(Hash) # FIXME condition = parse_condition(expression) @context.stack do input.select do |object| @context[variable] = object condition.evaluate(@context) end end || [] end
Filters an array of objects against an expression input - the object array variable - the variable to assign each item to in the expression expression - a Liquid comparison expression passed in as a string Returns the filtered array of objects
where_exp
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0
def to_integer(input) return 1 if input == true return 0 if input == false input.to_i end
Convert the input into integer input - the object string Returns the integer value
to_integer
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/jekyll-3.9.3/lib/jekyll/filters.rb
Apache-2.0