Yard doc cleanup
This commit is contained in:
parent
1855745d8e
commit
2965e3709d
10 changed files with 40 additions and 27 deletions
|
@ -62,15 +62,16 @@ module Middleman::CoreExtensions::Extensions
|
|||
|
||||
# Alias `extensions` to access registered extensions
|
||||
#
|
||||
# @return [Array<Module]
|
||||
# @return [Array<Module>]
|
||||
def extensions
|
||||
@extensions ||= []
|
||||
end
|
||||
|
||||
# Register a new extension
|
||||
#
|
||||
# @param [Array<Module>] new_extensions Extension modules to register
|
||||
# @return [Array<Module]
|
||||
# @param [Module] extension Extension modules to register
|
||||
# @param [Hash] options Per-extension options hash
|
||||
# @return [void]
|
||||
def register(extension, options={}, &block)
|
||||
@extensions ||= []
|
||||
@extensions += [extension]
|
||||
|
|
|
@ -102,11 +102,11 @@ module Middleman::CoreExtensions::FrontMatter
|
|||
@_frontmatter_extension ||= FrontMatter.new(self)
|
||||
end
|
||||
|
||||
# Get the frontmatter for the given params
|
||||
# Get the frontmatter for a given path
|
||||
# @param [String] path
|
||||
# @return [Hash, nil]
|
||||
def frontmatter(*args)
|
||||
frontmatter_extension.data(*args)
|
||||
# @return [Hash]
|
||||
def frontmatter(path)
|
||||
frontmatter_extension.data(path)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -171,8 +171,8 @@ module Middleman
|
|||
# to discover extensions and Sprockets-supporting gems.
|
||||
#
|
||||
# @private
|
||||
# @param [Gem::Specification]
|
||||
# @param [String] Path to look for
|
||||
# @param [Gem::Specification] spec
|
||||
# @param [String] path Path to look for
|
||||
# @return [Boolean] Whether the file exists
|
||||
def spec_has_file?(spec, path)
|
||||
full_path = File.join(spec.full_gem_path, path)
|
||||
|
|
|
@ -16,7 +16,11 @@ module Middleman::Sitemap::Extensions
|
|||
alias :included :registered
|
||||
end
|
||||
|
||||
# Helpers methods for Resources
|
||||
module ResourceInstanceMethods
|
||||
|
||||
# Whether the Resource is ignored
|
||||
# @return [Boolean]
|
||||
def ignored?
|
||||
@app.ignore_manager.ignored?(path) ||
|
||||
(!proxy? &&
|
||||
|
@ -25,25 +29,31 @@ module Middleman::Sitemap::Extensions
|
|||
end
|
||||
end
|
||||
|
||||
# Ignore-related instance methods
|
||||
module InstanceMethods
|
||||
def ignore_manager
|
||||
@_ignore_manager ||= IgnoreManager.new(self)
|
||||
end
|
||||
|
||||
def ignore(*args, &block)
|
||||
ignore_manager.ignore(*args, &block)
|
||||
# Ignore a path or add an ignore callback
|
||||
# @param [String, Regexp] path Path glob expression, or path regex
|
||||
# @return [void]
|
||||
def ignore(path=nil, &block)
|
||||
ignore_manager.ignore(path, &block)
|
||||
end
|
||||
end
|
||||
|
||||
# Class to handle managing ignores
|
||||
class IgnoreManager
|
||||
def initialize(app)
|
||||
@app = app
|
||||
|
||||
# Array of callbacks which can ass ignored
|
||||
@ignored_callbacks = []
|
||||
end
|
||||
|
||||
# Ignore a path or add an ignore callback
|
||||
# @param [String, Regexp] path, path glob expression, or path regex
|
||||
# @param [String, Regexp] path Path glob expression, or path regex
|
||||
# @return [void]
|
||||
def ignore(path=nil, &block)
|
||||
original_callback_size = @ignored_callbacks.size
|
||||
|
|
|
@ -32,8 +32,9 @@ module Middleman::Sitemap
|
|||
end
|
||||
|
||||
# Register a klass which can manipulate the main site map list
|
||||
# @param [Class] klass
|
||||
# @param [Boolean] immediately_rebuild
|
||||
# @param [Symbol] name Name of the manipulator for debugging
|
||||
# @param [Class, Module] inst Abstract namespace which can update the resource list
|
||||
# @param [Boolean] immediately_rebuild Whether the resource list should be immediately recalculated
|
||||
# @return [void]
|
||||
def register_resource_list_manipulator(name, inst, immediately_rebuild=true)
|
||||
@resource_list_manipulators << [name, inst]
|
||||
|
|
|
@ -15,9 +15,9 @@ module Middleman::Templates
|
|||
# @param [Symbol] name The name of the template
|
||||
# @param [Class] klass The class to be executed for this template
|
||||
# @return [Hash] List of registered templates
|
||||
def register(*args)
|
||||
def register(name=nil, klass=nil)
|
||||
@_template_mappings ||= {}
|
||||
@_template_mappings[args[0]] = args[1] if args.length == 2
|
||||
@_template_mappings[name] = klass if name && klass
|
||||
@_template_mappings
|
||||
end
|
||||
|
||||
|
|
|
@ -107,4 +107,4 @@ module Middleman
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue