kang 0.0.2 → 0.0.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/kang.rb +16 -12
- data/lib/kang/version.rb +1 -1
- metadata +31 -36
data/lib/kang.rb
CHANGED
@@ -25,9 +25,9 @@ end
|
|
25
25
|
|
26
26
|
module Kang
|
27
27
|
class Data
|
28
|
-
def initialize
|
29
|
-
|
30
|
-
|
28
|
+
def initialize(reg_text="",match_text="")
|
29
|
+
update_regexp(reg_text)
|
30
|
+
update_match_string(match_text)
|
31
31
|
end
|
32
32
|
|
33
33
|
def update_match_string(match_string)
|
@@ -45,7 +45,7 @@ module Kang
|
|
45
45
|
|
46
46
|
def match_group_count
|
47
47
|
if @match
|
48
|
-
@match.
|
48
|
+
@match.length
|
49
49
|
else
|
50
50
|
nil
|
51
51
|
end
|
@@ -86,7 +86,7 @@ module Kang
|
|
86
86
|
|
87
87
|
def matches
|
88
88
|
if @match and (@match.length > 1)
|
89
|
-
@match
|
89
|
+
@match.to_a
|
90
90
|
else
|
91
91
|
[]
|
92
92
|
end
|
@@ -95,8 +95,10 @@ module Kang
|
|
95
95
|
|
96
96
|
class Controller
|
97
97
|
def initialize
|
98
|
-
|
99
|
-
|
98
|
+
reg_text = "RegExp here"
|
99
|
+
match_text = "Match Text Here"
|
100
|
+
@view = View.new(self,reg_text,match_text)
|
101
|
+
@data = Data.new(reg_text,match_text)
|
100
102
|
@view.start
|
101
103
|
end
|
102
104
|
|
@@ -119,7 +121,9 @@ module Kang
|
|
119
121
|
@view.update_status("Invalid Regexp")
|
120
122
|
else
|
121
123
|
count = @data.match_group_count ? @data.match_group_count : "no"
|
122
|
-
|
124
|
+
message = "Matched with #{@data.match_group_count} grouping"
|
125
|
+
message += "s" if @data.match_group_count and @data.match_group_count > 1
|
126
|
+
@view.update_status(message)
|
123
127
|
if @data.match?
|
124
128
|
@view.update_tag(@data.match_begin,@data.match_end)
|
125
129
|
else
|
@@ -132,7 +136,7 @@ module Kang
|
|
132
136
|
end
|
133
137
|
|
134
138
|
class View
|
135
|
-
def initialize(controller)
|
139
|
+
def initialize(controller,reg_text="",match_text="")
|
136
140
|
@controller = controller
|
137
141
|
@window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
|
138
142
|
@window.set_title "Kang"
|
@@ -150,12 +154,12 @@ module Kang
|
|
150
154
|
@statusbar.push(0,"")
|
151
155
|
|
152
156
|
@regview = Gtk::TextView.new
|
153
|
-
@regview.buffer.text =
|
157
|
+
@regview.buffer.text = reg_text
|
154
158
|
|
155
159
|
@matchview = Gtk::TextView.new
|
156
|
-
@matchview.buffer.text =
|
160
|
+
@matchview.buffer.text = match_text
|
157
161
|
|
158
|
-
@matchview.buffer.create_tag("colors",{ "foreground" => "green", "background" => "
|
162
|
+
@matchview.buffer.create_tag("colors",{ "foreground" => "green", "background" => "gray" })
|
159
163
|
|
160
164
|
wintop.add(@regview)
|
161
165
|
winbottom.add(@matchview)
|
data/lib/kang/version.rb
CHANGED
metadata
CHANGED
@@ -1,67 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: kang
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Tony Doan
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-07 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: gtk2
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70347311322200 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :runtime
|
25
|
-
|
26
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70347311322200
|
25
|
+
description: The Ruby Regex Debugger. Put your regex in the top pane, and your match
|
26
|
+
text in the bottom pane. Kang will highlight the match text that matches and show
|
27
|
+
you any match groups you have created down the right hand side.
|
27
28
|
email: tdoan@tdoan.com
|
28
|
-
executables:
|
29
|
+
executables:
|
29
30
|
- kang
|
30
31
|
extensions: []
|
31
|
-
|
32
32
|
extra_rdoc_files: []
|
33
|
-
|
34
|
-
files:
|
33
|
+
files:
|
35
34
|
- lib/kang.rb
|
36
35
|
- lib/kang/cli.rb
|
37
36
|
- lib/kang/version.rb
|
38
37
|
- bin/kang
|
39
38
|
homepage: http://github.com/tdoan/kang
|
40
39
|
licenses: []
|
41
|
-
|
42
40
|
post_install_message:
|
43
41
|
rdoc_options: []
|
44
|
-
|
45
|
-
require_paths:
|
42
|
+
require_paths:
|
46
43
|
- lib
|
47
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
45
|
none: false
|
49
|
-
requirements:
|
50
|
-
- -
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version:
|
53
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
51
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version:
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
59
56
|
requirements: []
|
60
|
-
|
61
57
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.8.
|
58
|
+
rubygems_version: 1.8.7
|
63
59
|
signing_key:
|
64
60
|
specification_version: 3
|
65
61
|
summary: A visual regex debugger
|
66
62
|
test_files: []
|
67
|
-
|