Skip to content

Commit

Permalink
Merge branch 'master' into 0.7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed Jul 22, 2016
2 parents 1fb02be + 2968d62 commit 9038aa4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Hanami::Controller
Complete, fast and testable actions for Rack

## v0.7.0 - (unreleased)
## v0.7.0 - 2016-07-22
### Added
- [Luca Guidi] Introduced `Hanami::Action::Params#error_messages` which returns a flat collection of full error messages

Expand Down
24 changes: 12 additions & 12 deletions lib/hanami/action/base_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ module Action
class BaseParams
# The key that returns raw input from the Rack env
#
# @since x.x.x
# @since 0.7.0
RACK_INPUT = 'rack.input'.freeze

# The key that returns router params from the Rack env
# This is a builtin integration for Hanami::Router
#
# @since x.x.x
# @since 0.7.0
ROUTER_PARAMS = 'router.params'.freeze

# Separator for #get
#
# @since x.x.x
# @since 0.7.0
# @api private
#
# @see Hanami::Action::Params#get
GET_SEPARATOR = '.'.freeze

# @attr_reader env [Hash] the Rack env
#
# @since x.x.x
# @since 0.7.0
# @api private
attr_reader :env

# @attr_reader raw [Hash] the raw params from the request
#
# @since x.x.x
# @since 0.7.0
# @api private
attr_reader :raw

Expand All @@ -41,7 +41,7 @@ class BaseParams
#
# @return [Params]
#
# @since x.x.x
# @since 0.7.0
def initialize(env)
@env = env
@raw = _extract_params
Expand All @@ -55,7 +55,7 @@ def initialize(env)
#
# @return [Object,nil] return the associated object, if found
#
# @since x.x.x
# @since 0.7.0
def [](key)
@params[key]
end
Expand All @@ -69,7 +69,7 @@ def [](key)
#
# @raise [NoMethodError] if key is nil
#
# @since x.x.x
# @since 0.7.0
#
# @example
# require 'hanami/controller'
Expand Down Expand Up @@ -107,7 +107,7 @@ def get(key)
#
# @return [TrueClass] always returns true
#
# @since x.x.x
# @since 0.7.0
#
# @see Hanami::Action::Params#valid?
def valid?
Expand All @@ -118,15 +118,15 @@ def valid?
#
# @return [::Hash]
#
# @since x.x.x
# @since 0.7.0
def to_h
@params
end
alias_method :to_hash, :to_h

private

# @since x.x.x
# @since 0.7.0
# @api private
def _extract_params
result = {}
Expand All @@ -141,7 +141,7 @@ def _extract_params
result
end

# @since x.x.x
# @since 0.7.0
# @api private
def _router_params(fallback = {})
env.fetch(ROUTER_PARAMS, fallback)
Expand Down
4 changes: 2 additions & 2 deletions lib/hanami/action/cookie_jar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def []=(key, value)

# Keep track of changed keys
#
# @since x.x.x
# @since 0.7.0
# @api private
def changes
@changes ||= Set.new
Expand All @@ -123,7 +123,7 @@ def changes
# Check if the entire set of cookies has changed within the current request.
# If <tt>key</tt> is given, it checks the associated cookie has changed.
#
# @since x.x.x
# @since 0.7.0
# @api private
def changed?(key = nil)
if key.nil?
Expand Down
4 changes: 2 additions & 2 deletions lib/hanami/action/mime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def accept(*formats)
end
end

# @since x.x.x
# @since 0.7.0
# @api private
module InstanceMethods
# @since x.x.x
# @since 0.7.0
# @api private
def initialize(*)
super
Expand Down
8 changes: 4 additions & 4 deletions lib/hanami/action/params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Params < BaseParams

# This is a Hanami::Validations extension point
#
# @since x.x.x
# @since 0.7.0
# @api private
def self._base_rules
lambda do
Expand Down Expand Up @@ -58,7 +58,7 @@ def raw
#
# @return [Hash]
#
# @since x.x.x
# @since 0.7.0
#
# @example
# params.errors
Expand All @@ -71,7 +71,7 @@ def errors
#
# @return [Array]
#
# @since x.x.x
# @since 0.7.0
#
# @example
# params.error_messages
Expand Down Expand Up @@ -106,7 +106,7 @@ def to_h

private

# @since x.x.x
# @since 0.7.0
# @api private
def _extract_params
# FIXME: this is required for dry-v whitelisting
Expand Down
6 changes: 3 additions & 3 deletions lib/hanami/action/rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ def use(middleware, *args, &block)
# Hanami::Action::Params
#
# @api private
# @since x.x.x
# @since 0.7.0
def params_class
@params_class ||= BaseParams
end
end

# @since x.x.x
# @since 0.7.0
# @api private
module InstanceMethods
# @since x.x.x
# @since 0.7.0
# @api private
def initialize(*)
super
Expand Down

0 comments on commit 9038aa4

Please sign in to comment.