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