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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e376adeb1a695adbf719462380dd8f994e2218d
4
- data.tar.gz: eab4ed6d79468892a22b60042db4b0308276aeb9
3
+ metadata.gz: 6316bc9b5a8b93a7d5999ef727a2e263cf794bf3
4
+ data.tar.gz: d9ab1d3dd8345b035461fe1d80c7bfd48110d3d5
5
5
  SHA512:
6
- metadata.gz: 33e48df490c0435c18cc982be80d06a36d1b12466ae0fd09a9a2746b5c4db70c299be89220c4c5ec1250a8874baffd7aceaab2c2ef8e1e3bf78d2d2a8a90f1da
7
- data.tar.gz: 33543b545d07c123f451f3db93fce2f07945e2de4248fca97c3d27d7bb5c62c3da28b0eb25ae6ca3b003f7b5330a3db54dd5e3328318e6863a58d7f3de17912a
6
+ metadata.gz: c54ca347cec4f75ac5cbc013a10c3e4b026a6230256e94bae5d47ad0826fe20a55e9a55f7d87662b61eab923cd9d017d0de6d3a708964b0b99ba14c68935f18a
7
+ data.tar.gz: 222ae4ac1146dcb12744117d6868a628e9b2560165beee4e5e6b004df66277a04d7564f6f0e8be9b3aa1944419cf0967fa1ccfa5007d6e81010f28514df2f789
data/README.md CHANGED
@@ -22,6 +22,8 @@ Let's start creation long method chain.
22
22
 
23
23
  4. Let's enjoy shiritori!
24
24
 
25
+ - block syntax can use only '{}', not use 'do - end' syntax.
26
+ - if you want to pass arguments, please enclosed '()'.
25
27
 
26
28
  ## Usage
27
29
 
@@ -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
- rescue
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
 
@@ -1,3 +1,3 @@
1
1
  module Shiritori
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiritori
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - siman-man