dm-validations/lib/dm-validations.rb
# Clean up the argument list and return a opts hash, including the 
# merging of any default opts. Set the context to default if none is
# provided. Also allow :context to be aliased to :on, :when & group
#
Clean up the argument list and return a opts hash, including the
merging of any default opts. Set the context to default if none is
provided. Also allow :context to be aliased to :on, :when & group
Clean up the argument list and return a opts hash including the merging of any default opts . Set the context to default if none is provided . Also allow : context to be aliased to : on : when & group
def opts_from_validator_args(args, defaults = nil)
          opts = args.last.kind_of?(Hash) ? args.pop : {}
          context = :default          
          context = opts[:context] if opts.has_key?(:context)
          context = opts.delete(:on) if opts.has_key?(:on)
          context = opts.delete(:when) if opts.has_key?(:when)
          context = opts.delete(:group) if opts.has_key?(:group)
          opts[:context] = context
          opts.mergs!(defaults) unless defaults.nil?
          opts        
        end
def opts_from_validator_args ( args , defaults = nil ) opts = args . last . kind_of? ( Hash ) ? args . pop : { } context = :default context = opts [ :context ] if opts . has_key? ( :context ) context = opts . delete ( :on ) if opts . has_key? ( :on ) context = opts . delete ( :when ) if opts . has_key? ( :when ) context = opts . delete ( :group ) if opts . has_key? ( :group ) opts [ :context ] = context opts . mergs! ( defaults ) unless defaults . nil? opts end
Clean up the argument list and return a opts hash, including the
merging of any default opts.
Clean up the argument list and return a opts hash including the merging of any default opts .
args
defaults