moron_text 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 144d379141e2a6c2b6f27a3225fcd1a62f7df66f
4
- data.tar.gz: df899b273eceefcab7b505dcbb0829055f2d015a
3
+ metadata.gz: 7916232c07befc0444f4efdd041ea65b1b1610ab
4
+ data.tar.gz: 9c3f33ab51a0c37562a4a042eb2dc3b00b612708
5
5
  SHA512:
6
- metadata.gz: 274084399d161b9ffb57091f3bbae6c49a0c6f1fad3b2202048736ee92b47c8706723923f508be7fbd7e45c702535742c07b8eb0084be043e5067b52e85d2842
7
- data.tar.gz: 2ebae11133e9839546d02de3f6ba76f5e26fe871c2fc739c50605e47c408e3d5118baa404824bfc9d1a4020921d82162584f6a82787dab5b61289ce297986b22
6
+ metadata.gz: 2608039b0e22977b089697792955610cdfc87004b1f8ca9dcfc8d5ab0420d7f744953e47aae9220a1f809a6637b13b5bf869a4c8a3c010d357bdd44ec1411dae
7
+ data.tar.gz: c118c0169acecd13cddb6037d5226712f406ec24026d5110f288809a5fe06ec371aef8af535bef6c5fd37465da0210d226a662d11edd27a8ce5a963e3ab5ded1
data/README.md CHANGED
@@ -30,6 +30,7 @@ This is not ready yet.
30
30
  when 'CORRECT'
31
31
  when 'WRONG'
32
32
  when 'ON'
33
+ when :text
33
34
  else
34
35
  text.next
35
36
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
data/lib/moron_text.rb CHANGED
@@ -222,10 +222,7 @@ class Moron_Text
222
222
 
223
223
  case line[:type]
224
224
 
225
- when :text
226
- line
227
-
228
- when :command
225
+ when :command, :text
229
226
  if line.has_key?(:grab_all_text)
230
227
  line[:text] = [
231
228
  (line.has_key?(:text) ? line[:text] : nil),
@@ -244,7 +241,7 @@ class Moron_Text
244
241
  end
245
242
  end
246
243
 
247
- args = [line[:value], line, self]
244
+ args = [(line[:type] == :text ? :text : line[:value]), line, self]
248
245
  val = nil
249
246
  do_next = :next
250
247
 
data/specs/0010-run.rb CHANGED
@@ -21,4 +21,28 @@ describe :run do
21
21
  o.stack.should == [6, 90]
22
22
  end
23
23
 
24
+ it "passes text to block" do
25
+ o = Moron_Text.new(<<-EOF)
26
+ COMM 1 /*
27
+
28
+ This is text.
29
+
30
+ COMM 2 /*
31
+
32
+ This is more text.
33
+ EOF
34
+
35
+ stack = []
36
+ o.run do |name, line, moron|
37
+ stack << line[:value].strip
38
+ end
39
+
40
+ stack.should == [
41
+ 'COMM 1',
42
+ 'This is text.',
43
+ 'COMM 2',
44
+ 'This is more text.'
45
+ ]
46
+ end # === it passes text to block
47
+
24
48
  end # === describe ":run"
data/specs/0012-typo.rb CHANGED
@@ -26,14 +26,7 @@ describe :typo do
26
26
 
27
27
  lambda {
28
28
  o.run do |name, line, moron|
29
- case name
30
- when 'GOOSE'
31
- "done"
32
- when 'DUCK'
33
- fail moron.typo('blah 1')
34
- else
35
- moron.typo!
36
- end
29
+ fail moron.typo('blah 1') if name == 'DUCK'
37
30
  end
38
31
  }.
39
32
  should.raise(Moron_Text::TYPO).
@@ -51,14 +44,7 @@ describe :typo do
51
44
 
52
45
  lambda {
53
46
  o.run do |name, line, moron|
54
- case name
55
- when 'GOOSE'
56
- "done"
57
- when 'DUCK'
58
- fail moron.typo('blah 2')
59
- else
60
- moron.typo!
61
- end
47
+ fail moron.typo('blah 2') if name == 'DUCK'
62
48
  end
63
49
  }.
64
50
  should.raise(Moron_Text::TYPO).
@@ -77,14 +63,7 @@ describe :typo do
77
63
 
78
64
  lambda {
79
65
  o.run do |name, line, moron|
80
- case name
81
- when 'GOOSE'
82
- "done"
83
- when 'DUCK'
84
- fail moron.typo('blah 3')
85
- else
86
- moron.typo!
87
- end
66
+ fail moron.typo('blah 3') if name == 'DUCK'
88
67
  end
89
68
  }.
90
69
  should.raise(Moron_Text::TYPO).
@@ -10,11 +10,7 @@ describe :grab_prev_text do
10
10
 
11
11
  sounds = []
12
12
  o.run { |name, line, moron|
13
- if name == 'BIRD'
14
- sounds << moron.grab_prev_text
15
- else
16
- moron.typo!
17
- end
13
+ sounds << moron.grab_prev_text if name == 'BIRD'
18
14
  }
19
15
  sounds.should == ['This is text.']
20
16
  end
@@ -30,11 +26,7 @@ describe :grab_prev_text do
30
26
 
31
27
  txt = nil
32
28
  o.run { |name, line, moron|
33
- if name == 'DUCK'
34
- txt = moron.grab_prev_text
35
- else
36
- moron.typo!
37
- end
29
+ (txt = moron.grab_prev_text) if name == 'DUCK'
38
30
  }
39
31
  trim(txt).should == trim(<<-EOF)
40
32
  This is one line.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moron_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - da99
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: about_pos