text_parser 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module TextParser
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/lib/text_parser.rb CHANGED
@@ -4,8 +4,8 @@ module TextParser
4
4
  # [args] [Symbol] :dictionary, :order, :order_direction, :negative_dictionary
5
5
  # @return [Array of Hash]
6
6
  def parse(args = {})
7
+ args.delete_if {|key, value| value.nil? }
7
8
  options = {
8
- :dictionary => nil,
9
9
  :order => :word,
10
10
  :order_direction => :asc,
11
11
  :negative_dictionary => []
@@ -73,4 +73,10 @@ class TextParserTest < Test::Unit::TestCase
73
73
  def test_should_return_double_words
74
74
  assert_equal "I like the movie Forrest Gump.".parse(:dictionary => ["Forrest Gump"]), [{:word => "forrest gump", :hits => 1}]
75
75
  end
76
+
77
+ def test_should_manage_null_args
78
+ args = {:dictionary=>nil, :negative_dictionary=>nil, :order=>nil, :order_direction=>nil}
79
+ assert_equal "text".parse(args), [{:word => "text", :hits => 1}]
80
+ end
81
+
76
82
  end
data/text_parser.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "text_parser"
3
- s.version = "0.1.2"
3
+ s.version = "0.1.3"
4
4
  s.author = "Frederico de Paula"
5
5
  s.email = "fpaula@gmail.com"
6
6
  s.summary = "A easy way to parse text."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Frederico de Paula
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-06 00:00:00 -02:00
18
+ date: 2011-12-07 00:00:00 -02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21