shiritori 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/shiritori/shiritori.rb +22 -1
- data/lib/shiritori/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6316bc9b5a8b93a7d5999ef727a2e263cf794bf3
|
4
|
+
data.tar.gz: d9ab1d3dd8345b035461fe1d80c7bfd48110d3d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c54ca347cec4f75ac5cbc013a10c3e4b026a6230256e94bae5d47ad0826fe20a55e9a55f7d87662b61eab923cd9d017d0de6d3a708964b0b99ba14c68935f18a
|
7
|
+
data.tar.gz: 222ae4ac1146dcb12744117d6868a628e9b2560165beee4e5e6b004df66277a04d7564f6f0e8be9b3aa1944419cf0967fa1ccfa5007d6e81010f28514df2f789
|
data/README.md
CHANGED
data/lib/shiritori/shiritori.rb
CHANGED
@@ -6,6 +6,9 @@ module Shiritori
|
|
6
6
|
include SearchMethod
|
7
7
|
include View
|
8
8
|
|
9
|
+
RED = 31
|
10
|
+
GREEN = 32
|
11
|
+
|
9
12
|
EXIT_PATTERN = /(exit|quit)/.freeze
|
10
13
|
METHOD_PATTERN = /[\w|\?|\>|\<|\=|\!|\[|\[|\]|\*|\/|\+|\-|\^|\~|\@|\%|\&|]+/.freeze
|
11
14
|
|
@@ -22,6 +25,7 @@ module Shiritori
|
|
22
25
|
|
23
26
|
begin
|
24
27
|
@current_class = @current_object.class
|
28
|
+
@success = true
|
25
29
|
rescue Exception => ex
|
26
30
|
@current_class = "Undefined"
|
27
31
|
end
|
@@ -34,23 +38,40 @@ module Shiritori
|
|
34
38
|
@current_class = Object
|
35
39
|
@current_chain = []
|
36
40
|
@chain_count = 0
|
41
|
+
@success = false
|
37
42
|
|
38
43
|
$stdout.print "Please input first object > "
|
39
44
|
begin
|
40
45
|
str = $stdin.gets.chomp
|
41
46
|
@current_object = eval(str)
|
42
47
|
@current_chain << @current_object.to_ss
|
43
|
-
|
48
|
+
@success = true
|
49
|
+
rescue Exception => ex
|
44
50
|
new_line
|
45
51
|
$stdout.puts "Undefined object error"
|
52
|
+
init
|
46
53
|
end
|
47
54
|
update
|
48
55
|
end
|
49
56
|
|
57
|
+
def success?
|
58
|
+
@success
|
59
|
+
end
|
60
|
+
|
50
61
|
def run
|
62
|
+
|
51
63
|
loop do
|
52
64
|
show_status
|
53
65
|
|
66
|
+
if success?
|
67
|
+
puts "\e[#{GREEN}mSuccess!\e[m"
|
68
|
+
@success = false
|
69
|
+
else
|
70
|
+
puts "\e[#{RED}mFailed!\e[m"
|
71
|
+
end
|
72
|
+
|
73
|
+
new_line
|
74
|
+
|
54
75
|
print "Please input next method > "
|
55
76
|
command = $stdin.gets
|
56
77
|
|
data/lib/shiritori/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -31,6 +31,7 @@ module Helpers
|
|
31
31
|
ope = ope.to_s if ope.is_a?(Symbol)
|
32
32
|
|
33
33
|
command = "#{ope}(#{args.join(',')})"
|
34
|
+
puts "self."+command
|
34
35
|
expect(check(command, obj||object)).to eq [ope.scan(METHOD_PATTERN).first.to_sym, test_obj.instance_eval{ eval("self."+command) } ]
|
35
36
|
end
|
36
37
|
end
|