text_parser 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/text_parser/version.rb +1 -1
- data/lib/text_parser.rb +1 -1
- data/test/text_parser_test.rb +6 -0
- data/text_parser.gemspec +1 -1
- metadata +4 -4
data/lib/text_parser/version.rb
CHANGED
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 => []
|
data/test/text_parser_test.rb
CHANGED
@@ -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
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:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
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-
|
18
|
+
date: 2011-12-07 00:00:00 -02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|