Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Aug 12, 2013
1 parent 98d7339 commit c59a642
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/ooor/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,18 @@ def method_missing(method_symbol, *arguments)

private

def extract_validation_error(e)
e.faultCode.split("\n").each do |line|
if line.index(': ')
fields = line.split(": ")[0].split(' ').last.split(',')
msg = line.split(": ")[1]
fields.each do |field|
errors.add(field.strip.to_sym, msg)
end
end
def extract_validation_error(error)
error.faultCode.split("\n").each do |line|
extract_error_line(line) if line.index(': ')
end
end

def extract_error_line(line)
fields = line.split(": ")[0].split(' ').last.split(',')
msg = line.split(": ")[1]
fields.each { |field| errors.add(field.strip.to_sym, msg) }
end

# Ruby 1.9.compat, See also http://tenderlovemaking.com/2011/06/28/til-its-ok-to-return-nil-from-to_ary/
def to_ary; nil; end # :nodoc:

Expand Down

0 comments on commit c59a642

Please sign in to comment.