display 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/display.rb +6 -5
- data/spec/spec.display.rb +6 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/display.rb
CHANGED
@@ -15,16 +15,16 @@ class Object
|
|
15
15
|
end
|
16
16
|
|
17
17
|
exact_line = File.readlines(file)[line.to_i - 1].strip
|
18
|
-
parser=RedParse.new(exact_line)
|
18
|
+
parser = RedParse.new(exact_line)
|
19
19
|
tree = parser.parse
|
20
20
|
out = nil
|
21
21
|
# the trick is to break out with the first method call...
|
22
22
|
right_call_node = give_me_first_call_node tree
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
"#{p.unparse}=#{args.shift}"
|
23
|
+
out = "[#{File.basename(file)},#{line}] "
|
24
|
+
args2 = right_call_node.params.map{ |p|
|
25
|
+
"#{p.unparse}=#{args.shift}"
|
27
26
|
}.join(', ')
|
27
|
+
out += args2
|
28
28
|
|
29
29
|
puts out
|
30
30
|
out
|
@@ -33,6 +33,7 @@ class Object
|
|
33
33
|
def give_me_first_call_node tree
|
34
34
|
tree.walk{|parent,i,subi,node|
|
35
35
|
if node.class == RedParse::CallNode
|
36
|
+
# eureka
|
36
37
|
return tree
|
37
38
|
else
|
38
39
|
return give_me_first_call_node(node.right)
|
data/spec/spec.display.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'sane'
|
3
|
-
|
3
|
+
require_relative '../lib/display'
|
4
4
|
require 'spec/autorun'
|
5
5
|
|
6
6
|
describe "display" do
|
@@ -11,11 +11,15 @@ describe "display" do
|
|
11
11
|
@output = display a, b
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should
|
14
|
+
it "should display the args" do
|
15
15
|
assert @output.contain?( "a=")
|
16
16
|
assert @output.contain?( "b=")
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should have an [] style output" do
|
20
|
+
assert @output =~ /\[.*\]/
|
21
|
+
end
|
22
|
+
|
19
23
|
it "should add spacing appropriately with commas" do
|
20
24
|
assert @output.contain?(", ")
|
21
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: display
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roger Pack
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|