string_utility_belt 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +18 -10
- data/Gemfile.lock +4 -1
- data/Rakefile +1 -1
- data/lib/string_utility_belt.rb +1 -0
- data/lib/string_utility_belt/commons.rb +1 -0
- data/lib/string_utility_belt/general.rb +0 -20
- data/lib/string_utility_belt/regex_me/lib/helper.rb +1 -1
- data/lib/string_utility_belt/version.rb +1 -1
- data/string_utility_belt.gemspec +1 -0
- data/test/string_utility_belt/commons_test.rb +10 -0
- data/test/string_utility_belt/entities_test.rb +1 -0
- data/test/string_utility_belt/general_test.rb +3 -44
- data/test/string_utility_belt/match_rank_test.rb +3 -0
- data/test/string_utility_belt/regex_me/builders_test.rb +2 -0
- data/test/string_utility_belt/regex_me/helper_test.rb +2 -0
- data/test/string_utility_belt/tags_test.rb +1 -0
- data/test/test_helper.rb +5 -2
- data/test/test_suite.rb +9 -0
- metadata +23 -8
data/CHANGELOG.markdown
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
+
# 0.4.0
|
2
|
+
## Summary: New dependency
|
3
|
+
* Adicionado <a href="https://github.com/serradura/stringub-commons">stringub-commons</a> como dependência do projeto.
|
4
|
+
- Adicionam os métodos words e unique_spaces (que entrou no lugar do simple_space).
|
5
|
+
* Testes foram refatorados fazendo com que suas dependências fossem isoladas.
|
6
|
+
|
1
7
|
# 0.3.3
|
2
8
|
## Summary: Docs
|
3
9
|
* Criado change log para listar as principais alterações entre cada versão.
|
4
10
|
* Criado ROADMAP para informar os planos para a gem.
|
5
|
-
* Adicionado warnings para alertar quais métodos que estarão depreciados na próxima versão,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
* Adicionado warnings para alertar quais métodos que estarão depreciados na próxima versão, abaixo está a listagem dos métodos que serão depreciados:
|
12
|
+
- simple_space
|
13
|
+
- simple_space!
|
14
|
+
- regex_me_to_search_ruby
|
15
|
+
- regex_me_to_search_mysql
|
16
|
+
- have_this_words
|
17
|
+
- not_have_this_words?
|
18
|
+
- total_frequency_by
|
19
|
+
- words_frequency_by
|
20
|
+
- match_and_score_by
|
21
|
+
- decode_entities_and_cleaner
|
14
22
|
|
15
23
|
# 0.3.2
|
16
24
|
## Summary: Refactory
|
@@ -26,7 +34,7 @@ para instala-lá juntamente com o string_utility_belt
|
|
26
34
|
* Todos os módulos foram refatorados
|
27
35
|
* Também foram criada classes internas para encapsular a lógica nas libs General e MatchRank (Começarm planos para serem uma gem a parte).
|
28
36
|
|
29
|
-
#
|
37
|
+
# 0.2.5
|
30
38
|
## Summary: Test coverage
|
31
39
|
* 100% de cobertura de teste
|
32
40
|
* E pequenas refatorações foram feitas ao longo do processo.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
string_utility_belt (0.
|
4
|
+
string_utility_belt (0.3.3)
|
5
|
+
htmlentities (= 4.3.0)
|
6
|
+
stringub-commons
|
5
7
|
|
6
8
|
GEM
|
7
9
|
remote: http://rubygems.org/
|
@@ -17,6 +19,7 @@ GEM
|
|
17
19
|
ruby-debug-base (~> 0.10.4.0)
|
18
20
|
ruby-debug-base (0.10.4)
|
19
21
|
linecache (>= 0.3)
|
22
|
+
stringub-commons (0.0.2)
|
20
23
|
|
21
24
|
PLATFORMS
|
22
25
|
ruby
|
data/Rakefile
CHANGED
data/lib/string_utility_belt.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require 'stringub-commons'
|
@@ -45,26 +45,6 @@ module StringUtilityBelt
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
WORD_PATTERN = /\w[\w\'\-]*/
|
49
|
-
ANY_SPACE_PATTERN = /\s+/
|
50
|
-
|
51
|
-
SIMPLE_SPACE = " "
|
52
|
-
|
53
|
-
def words
|
54
|
-
self.scan(WORD_PATTERN)
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
warn "StringUtilityBelt:General.simple_space will be deprecated in the next_version"
|
59
|
-
def simple_space
|
60
|
-
self.gsub(ANY_SPACE_PATTERN, SIMPLE_SPACE)
|
61
|
-
end
|
62
|
-
|
63
|
-
warn "StringUtilityBelt:General.simple_space! will be deprecated in the next_version"
|
64
|
-
def simple_space!
|
65
|
-
self.gsub!(ANY_SPACE_PATTERN, SIMPLE_SPACE)
|
66
|
-
end
|
67
|
-
|
68
48
|
warn "StringUtilityBelt::General.have_this_words? will be deprecated in the next_version"
|
69
49
|
def have_this_words?(words_to_match, options = nil)
|
70
50
|
i = GENERAL.new(self)
|
data/string_utility_belt.gemspec
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
|
+
|
3
|
+
class CommonsTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_should_contains_commons_module
|
6
|
+
require File.join('string_utility_belt', 'commons')
|
7
|
+
assert Stringub.constants.include?("Commons")
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
@@ -1,57 +1,16 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
|
+
require File.join('string_utility_belt', 'commons')
|
3
|
+
require File.join('string_utility_belt', 'regex_me')
|
4
|
+
require File.join('string_utility_belt', 'general')
|
2
5
|
|
3
6
|
class GeneralTest < Test::Unit::TestCase
|
4
7
|
|
5
8
|
def setup
|
6
|
-
@spaces_and_some_text = " \n \r \t\r\n foo \t bar "
|
7
|
-
|
8
9
|
@text = %q{Texto de teste!
|
9
10
|
Esta classe deverá fazer a busca por uma ou um grupo de palavras
|
10
11
|
em um texto e retornar um rank com a quantidade identificada.}
|
11
12
|
end
|
12
13
|
|
13
|
-
def test_should_return_a_single_word_in_array
|
14
|
-
assert_equal %w{Hello}, "Hello".words
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_should_return_all_words_as_element_in_array
|
18
|
-
assert_equal ["foo-foo", "bar's", "bar"], "foo-foo, bar's. bar!".words
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_should_replace_a_sequence_of_space_per_a_unique_space
|
22
|
-
assert_equal " foo bar ", @spaces_and_some_text.simple_space
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_should_replace_the_left_spaces_by_only_one
|
26
|
-
assert_equal ' \o/!'.simple_space, ' \o/!'
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_should_replace_the_right_spaces_by_only_one
|
30
|
-
assert_equal '\o/! '.simple_space, '\o/! '
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_should_be_the_same_result_after_calling_the_method
|
34
|
-
string = @spaces_and_some_text.dup
|
35
|
-
assert_equal string, " \n \r \t\r\n foo \t bar "
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_should_return_the_same_text_if_nothing_changed
|
39
|
-
assert_equal "Hello", "Hello".simple_space
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
#describe #simple_space!
|
44
|
-
def test_should_not_generate_a_new_object
|
45
|
-
@spaces_and_some_text.simple_space!
|
46
|
-
|
47
|
-
assert_not_same ' foo bar ', @spaces_and_some_text
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_should_return_nil_if_nothing_changed
|
51
|
-
assert_nil "Hello".simple_space!
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
14
|
# describe #have_this_words?
|
56
15
|
def test_should_be_true_if_find_all_of_the_text_fragments
|
57
16
|
assert @text.have_this_words?("busca ran".words)
|
@@ -1,4 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
|
+
require File.join('string_utility_belt', 'commons')
|
3
|
+
require File.join('string_utility_belt', 'regex_me')
|
4
|
+
require File.join('string_utility_belt', 'match_rank')
|
2
5
|
|
3
6
|
class MatchRankTest < Test::Unit::TestCase
|
4
7
|
|
data/test/test_helper.rb
CHANGED
data/test/test_suite.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.join('test', 'test_helper')
|
2
|
+
require File.join('test', 'string_utility_belt', 'commons_test')
|
3
|
+
require File.join('test', 'string_utility_belt', 'regex_me', 'builders_test')
|
4
|
+
require File.join('test', 'string_utility_belt', 'regex_me', 'helper_test')
|
5
|
+
require File.join('test', 'string_utility_belt', 'tags_test')
|
6
|
+
require File.join('test', 'string_utility_belt', 'entities_test')
|
7
|
+
require File.join('test', 'string_utility_belt', 'general_test')
|
8
|
+
require File.join('test', 'string_utility_belt', 'match_rank_test')
|
9
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_utility_belt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rodrigo Serradura
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-07-28 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: htmlentities
|
@@ -34,6 +33,20 @@ dependencies:
|
|
34
33
|
version: 4.3.0
|
35
34
|
type: :runtime
|
36
35
|
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: stringub-commons
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
37
50
|
description: Adds new features for String objects.
|
38
51
|
email:
|
39
52
|
- rserradura@gmail.com
|
@@ -52,6 +65,7 @@ files:
|
|
52
65
|
- ROADMAP.markdown
|
53
66
|
- Rakefile
|
54
67
|
- lib/string_utility_belt.rb
|
68
|
+
- lib/string_utility_belt/commons.rb
|
55
69
|
- lib/string_utility_belt/entities.rb
|
56
70
|
- lib/string_utility_belt/general.rb
|
57
71
|
- lib/string_utility_belt/match_rank.rb
|
@@ -63,6 +77,7 @@ files:
|
|
63
77
|
- lib/string_utility_belt/tags.rb
|
64
78
|
- lib/string_utility_belt/version.rb
|
65
79
|
- string_utility_belt.gemspec
|
80
|
+
- test/string_utility_belt/commons_test.rb
|
66
81
|
- test/string_utility_belt/entities_test.rb
|
67
82
|
- test/string_utility_belt/general_test.rb
|
68
83
|
- test/string_utility_belt/match_rank_test.rb
|
@@ -70,7 +85,7 @@ files:
|
|
70
85
|
- test/string_utility_belt/regex_me/helper_test.rb
|
71
86
|
- test/string_utility_belt/tags_test.rb
|
72
87
|
- test/test_helper.rb
|
73
|
-
|
88
|
+
- test/test_suite.rb
|
74
89
|
homepage: ""
|
75
90
|
licenses: []
|
76
91
|
|
@@ -100,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
115
|
requirements: []
|
101
116
|
|
102
117
|
rubyforge_project: string_utility_belt
|
103
|
-
rubygems_version: 1.
|
118
|
+
rubygems_version: 1.8.2
|
104
119
|
signing_key:
|
105
120
|
specification_version: 3
|
106
121
|
summary: Useful methods to handle strings
|