lib/dm-is-reflective/reflective.rb in dm-is-reflective-1.3.1 vs lib/dm-is-reflective/reflective.rb in dm-is-reflective-1.3.2

- old
+ new

@@ -53,16 +53,22 @@ result = fields.map{ |field| name, type, attrs = field reflected = targets.each{ |target| case target - when Regexp; - break name if name.to_s =~ target + when Regexp + if name.to_s =~ target + if name.to_s =~ /^\d/ + break :"_#{name}" # TODO: missing test for this + else + break name + end + end - when Symbol, String; + when Symbol, String break name if name == target.to_sym - when Class; + when Class break name if type == target else raise ArgumentError.new("invalid argument: #{target.inspect}") end