class GraphitiSpecHelpers::ErrorsProxy
Public Class Methods
new(array)
click to toggle source
# File lib/graphiti_spec_helpers/errors_proxy.rb, line 38 def initialize(array) @errors = array.map { |e| Error.new(e) } end
Public Instance Methods
[](key)
click to toggle source
# File lib/graphiti_spec_helpers/errors_proxy.rb, line 42 def [](key) @errors[key] end
each(&blk)
click to toggle source
# File lib/graphiti_spec_helpers/errors_proxy.rb, line 46 def each(&blk) @errors.each(&blk) end
length()
click to toggle source
# File lib/graphiti_spec_helpers/errors_proxy.rb, line 50 def length count end
method_missing(id, *args, &blk)
click to toggle source
Calls superclass method
# File lib/graphiti_spec_helpers/errors_proxy.rb, line 62 def method_missing(id, *args, &blk) if error = @errors.select { |e| e.attribute.to_sym == id } error = error[0] if error.length == 1 return error else super end end
to_h()
click to toggle source
# File lib/graphiti_spec_helpers/errors_proxy.rb, line 54 def to_h {}.tap do |hash| @errors.each do |e| hash[e.attribute] = e.message end end end