Yard doc cleanup 2
This commit is contained in:
parent
2965e3709d
commit
7b8457d963
|
@ -40,8 +40,8 @@ module Middleman
|
||||||
|
|
||||||
# Set class-wide defaults
|
# Set class-wide defaults
|
||||||
#
|
#
|
||||||
# @param [Symbol] Unique key name
|
# @param [Symbol] key Unique key name
|
||||||
# @param Default value
|
# @param value Default value
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def set(key, value=nil, &block)
|
def set(key, value=nil, &block)
|
||||||
@defaults ||= {}
|
@defaults ||= {}
|
||||||
|
@ -55,8 +55,8 @@ module Middleman
|
||||||
|
|
||||||
# Set attributes (global variables)
|
# Set attributes (global variables)
|
||||||
#
|
#
|
||||||
# @param [Symbol] Name of the attribue
|
# @param [Symbol] key Name of the attribue
|
||||||
# @param Attribute value
|
# @param value Attribute value
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def set(key, value=nil, &block)
|
def set(key, value=nil, &block)
|
||||||
setter = "#{key}=".to_sym
|
setter = "#{key}=".to_sym
|
||||||
|
|
|
@ -100,7 +100,7 @@ module Middleman
|
||||||
|
|
||||||
# Use Rack middleware
|
# Use Rack middleware
|
||||||
#
|
#
|
||||||
# @param [Class] Middleware
|
# @param [Class] middleware Middleware module
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def use(middleware, *args, &block)
|
def use(middleware, *args, &block)
|
||||||
@middleware ||= []
|
@middleware ||= []
|
||||||
|
@ -109,7 +109,7 @@ module Middleman
|
||||||
|
|
||||||
# Add Rack App mapped to specific path
|
# Add Rack App mapped to specific path
|
||||||
#
|
#
|
||||||
# @param [String] Path to map
|
# @param [String] map Path to map
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def map(map, &block)
|
def map(map, &block)
|
||||||
@mappings ||= []
|
@mappings ||= []
|
||||||
|
@ -229,8 +229,7 @@ module Middleman
|
||||||
|
|
||||||
# Rack Interface
|
# Rack Interface
|
||||||
#
|
#
|
||||||
# @private
|
# @param env Rack environment
|
||||||
# @param Rack environment
|
|
||||||
def call!(env)
|
def call!(env)
|
||||||
self.env = env
|
self.env = env
|
||||||
# Store environment, request and response for later
|
# Store environment, request and response for later
|
||||||
|
@ -250,16 +249,18 @@ module Middleman
|
||||||
|
|
||||||
# Halt the current request and return a response
|
# Halt the current request and return a response
|
||||||
#
|
#
|
||||||
# @private
|
# @param [String] response Response value
|
||||||
# @param [String] Response value
|
|
||||||
def halt(response)
|
def halt(response)
|
||||||
throw :halt, response
|
throw :halt, response
|
||||||
end
|
end
|
||||||
|
|
||||||
# Core response method. We process the request, check with the sitemap,
|
# Core response method. We process the request, check with
|
||||||
# and return the correct file, response or status message.
|
# the sitemap, and return the correct file, response or status
|
||||||
|
# message.
|
||||||
#
|
#
|
||||||
# @private
|
# @param env
|
||||||
|
# @param [Rack::Request] req
|
||||||
|
# @param [Rack::Response] res
|
||||||
def process_request(env, req, res)
|
def process_request(env, req, res)
|
||||||
start_time = Time.now
|
start_time = Time.now
|
||||||
|
|
||||||
|
|
|
@ -61,15 +61,14 @@ module Middleman
|
||||||
|
|
||||||
# Either get the cached key or save the contents of the block
|
# Either get the cached key or save the contents of the block
|
||||||
#
|
#
|
||||||
# @param Anything Hash can use as a key
|
# @param key Anything Hash can use as a key
|
||||||
# @return Cached value
|
|
||||||
def fetch(*key)
|
def fetch(*key)
|
||||||
@cache[key] ||= yield
|
@cache[key] ||= yield
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether the key is in the cache
|
# Whether the key is in the cache
|
||||||
#
|
#
|
||||||
# @param Anything Hash can use as a key
|
# @param key Anything Hash can use as a key
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def has_key?(key)
|
def has_key?(key)
|
||||||
@cache.has_key?(key)
|
@cache.has_key?(key)
|
||||||
|
@ -77,31 +76,34 @@ module Middleman
|
||||||
|
|
||||||
# Get a specific key
|
# Get a specific key
|
||||||
#
|
#
|
||||||
# @param Anything Hash can use as a key
|
# @param key Anything Hash can use as a key
|
||||||
# @return Cached value
|
|
||||||
def get(key)
|
def get(key)
|
||||||
@cache[key]
|
@cache[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Array of keys
|
||||||
|
# @return [Array]
|
||||||
def keys
|
def keys
|
||||||
@cache.keys
|
@cache.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
# Clear the entire cache
|
# Clear the entire cache
|
||||||
|
# @return [void]
|
||||||
def clear
|
def clear
|
||||||
@cache = {}
|
@cache = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set a specific key
|
# Set a specific key
|
||||||
#
|
#
|
||||||
# @param Anything Hash can use as a key
|
# @param key Anything Hash can use as a key
|
||||||
# @param Cached value
|
# @param value Cached value
|
||||||
|
# @return [void]
|
||||||
def set(key, value)
|
def set(key, value)
|
||||||
@cache[key] = value
|
@cache[key] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
# Remove a specific key
|
# Remove a specific key
|
||||||
# @param Anything Hash can use as a key
|
# @param key Anything Hash can use as a key
|
||||||
def remove(*key)
|
def remove(*key)
|
||||||
@cache.delete(key)
|
@cache.delete(key)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue