Class: NamedParameter::Errors::NotHash

Inherits:
Object
  • Object
show all
Defined in:
lib/named_parameter/errors/not_hash.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ NotHash

Returns a new instance of NotHash.



13
14
15
# File 'lib/named_parameter/errors/not_hash.rb', line 13

def initialize(error)
  @error = error
end

Class Method Details

.all_when(named_method, options) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/named_parameter/errors/not_hash.rb', line 3

def self.all_when(named_method,options)
  args = options[:called_with]
  if args.is_a? Hash
    []
  else
    error = NamedParameter::Error.new(named_method,args,caller)
    [NotHash.new(error)]
  end
end

Instance Method Details

#raise_argsObject



17
18
19
# File 'lib/named_parameter/errors/not_hash.rb', line 17

def raise_args
  [error_message,@error.backtrace]
end