From: Neil Smith Date: Fri, 3 Feb 2012 18:41:44 +0000 (+0000) Subject: Tweaked Label#split default regexp X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=df86d6dec3f5944842cf8e5cdcaa909bfc7e0406;p=erd-marker.git Tweaked Label#split default regexp --- diff --git a/lib/erd_handler/label.rb b/lib/erd_handler/label.rb index 6c19758..cdeacb1 100644 --- a/lib/erd_handler/label.rb +++ b/lib/erd_handler/label.rb @@ -12,7 +12,7 @@ class Label regexp = opts split_camel_case = true else - regexp = opts[:regexp] || /[ _,.-]+/ + regexp = opts[:regexp] || /[\t\n _,.-]+/ if opts.has_key? :camel_case split_camel_case = opts[:camel_case] else diff --git a/spec/erd_handler/label_spec.rb b/spec/erd_handler/label_spec.rb index 7879c6f..b432b46 100644 --- a/spec/erd_handler/label_spec.rb +++ b/spec/erd_handler/label_spec.rb @@ -84,9 +84,9 @@ module ErdHandler end it "splits the original using a default regexp" do - l1 = Label.new "Test label_string" + l1 = Label.new "Test label_string\tfred" l1.split - l1.processed.should == ["Test", "label", "string"] + l1.processed.should == ["Test", "label", "string", "fred"] end it "splits the original on camel case by default" do @@ -142,7 +142,6 @@ module ErdHandler l1.tidy l2.split.downcase.stem l1.processed.should == l2.processed - end end # tidy