lib/nameable.rb in nameable-0.2.0 vs lib/nameable.rb in nameable-0.3.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2010 Chris Horn http://chorn.com/ +# Copyright (c) 2012 Chris Horn http://chorn.com/ # See MIT-LICENSE.txt # TODO: Make this less sucky. module Nameable @@ -137,14 +137,13 @@ @middle.capitalize! if @middle and !(@middle =~ /[a-z]/ and @middle =~ /[A-Z]/) @middle = "#{@middle}." if @middle and @middle.size == 1 end def parse(name) + raise InvalidNameError unless name if name.class == String if name.index(',') name = "#{$2} #{$1}" if name =~ /^([a-z]+),(.*)/i - - #name = "#{$2} #{$1}" if name =~ /^([a-z]+),(.*)/i end name = name.strip.split(/\s+/) end