rugex 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +3 -3
- data/VERSION +1 -1
- data/lib/rugex/string.rb +1 -1
- data/rugex.gemspec +1 -4
- data/spec/lib/string_spec.rb +2 -2
- metadata +3 -6
- data/lib/rugex/regex.rb +0 -8
- data/spec/lib/regex_spec.rb +0 -29
data/README.textile
CHANGED
@@ -19,13 +19,13 @@ h2. For example:
|
|
19
19
|
<pre><code>rugex aquarius aqua</code></pre>
|
20
20
|
=> *aqua* rius
|
21
21
|
|
22
|
-
<pre><code>rugex aquarius
|
23
|
-
=> *aqua* rius
|
22
|
+
<pre><code>rugex 'new aquarius' aqua</code></pre>
|
23
|
+
=> new *aqua* rius
|
24
24
|
|
25
25
|
<pre><code>rugex aquarius ^a.+u</code></pre>
|
26
26
|
=> *aquariu* s
|
27
27
|
|
28
|
-
<pre><code>rugex aquarius
|
28
|
+
<pre><code>rugex aquarius 'a[qr]'</code></pre>
|
29
29
|
=> *aq* u *ar* ius
|
30
30
|
|
31
31
|
h1. TODO
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/rugex/string.rb
CHANGED
@@ -13,7 +13,7 @@ module Rugex
|
|
13
13
|
|
14
14
|
def initialize(text, regex_string)
|
15
15
|
raise EmptyRegexError if regex_string.empty?
|
16
|
-
@text, @regex = text,
|
16
|
+
@text, @regex = text, Regexp.new(regex_string)
|
17
17
|
@result = (@text =~ @regex) == nil ? '(no matches)' : print_colored_text
|
18
18
|
end
|
19
19
|
|
data/rugex.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rugex}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Lucas Caton"]
|
@@ -29,10 +29,8 @@ Gem::Specification.new do |s|
|
|
29
29
|
"VERSION",
|
30
30
|
"bin/rugex",
|
31
31
|
"lib/rugex/print.rb",
|
32
|
-
"lib/rugex/regex.rb",
|
33
32
|
"lib/rugex/string.rb",
|
34
33
|
"rugex.gemspec",
|
35
|
-
"spec/lib/regex_spec.rb",
|
36
34
|
"spec/lib/string_spec.rb",
|
37
35
|
"spec/spec_helper.rb"
|
38
36
|
]
|
@@ -42,7 +40,6 @@ Gem::Specification.new do |s|
|
|
42
40
|
s.rubygems_version = %q{1.4.1}
|
43
41
|
s.summary = %q{A simple tool for testing regular expressions from Ruby using the terminal}
|
44
42
|
s.test_files = [
|
45
|
-
"spec/lib/regex_spec.rb",
|
46
43
|
"spec/lib/string_spec.rb",
|
47
44
|
"spec/spec_helper.rb"
|
48
45
|
]
|
data/spec/lib/string_spec.rb
CHANGED
@@ -5,12 +5,12 @@ describe 'Rugex::String' do
|
|
5
5
|
context 'successful' do
|
6
6
|
it 'checks text with regular expression' do
|
7
7
|
output = Rugex::String.new('John Doe', 'ohn')
|
8
|
-
output.to_s.should == "J\e[0;
|
8
|
+
output.to_s.should == "J\e[0;31m\e[4mohn\e[0;37m Doe"
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'checks text with other regular expression' do
|
12
12
|
output = Rugex::String.new('John Doe', 'John D')
|
13
|
-
output.to_s.should == "\e[0;
|
13
|
+
output.to_s.should == "\e[0;31m\e[4mJohn D\e[0;37moe"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rugex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lucas Caton
|
@@ -86,10 +86,8 @@ files:
|
|
86
86
|
- VERSION
|
87
87
|
- bin/rugex
|
88
88
|
- lib/rugex/print.rb
|
89
|
-
- lib/rugex/regex.rb
|
90
89
|
- lib/rugex/string.rb
|
91
90
|
- rugex.gemspec
|
92
|
-
- spec/lib/regex_spec.rb
|
93
91
|
- spec/lib/string_spec.rb
|
94
92
|
- spec/spec_helper.rb
|
95
93
|
has_rdoc: true
|
@@ -127,6 +125,5 @@ signing_key:
|
|
127
125
|
specification_version: 3
|
128
126
|
summary: A simple tool for testing regular expressions from Ruby using the terminal
|
129
127
|
test_files:
|
130
|
-
- spec/lib/regex_spec.rb
|
131
128
|
- spec/lib/string_spec.rb
|
132
129
|
- spec/spec_helper.rb
|
data/lib/rugex/regex.rb
DELETED
data/spec/lib/regex_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Rugex::Regex' do
|
4
|
-
describe '.to_regex' do
|
5
|
-
context 'receiving a string without slashes' do
|
6
|
-
it 'returns a Regexp object' do
|
7
|
-
regex = Rugex::Regex.to_regex '\d{4}\d{2}-\d{2}'
|
8
|
-
regex.should == /\d{4}\d{2}-\d{2}/
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'returns a empty Regexp object' do
|
12
|
-
regex = Rugex::Regex.to_regex ''
|
13
|
-
regex.should == //
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'receiving a string with slashes' do
|
18
|
-
it 'returns a Regexp object' do
|
19
|
-
regex = Rugex::Regex.to_regex '/\d{4}\d{2}-\d{2}/'
|
20
|
-
regex.should == /\d{4}\d{2}-\d{2}/
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'returns a empty Regexp object' do
|
24
|
-
regex = Rugex::Regex.to_regex '//'
|
25
|
-
regex.should == //
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|