cutest-cj 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cutest.rb +23 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 125e11cb0f7c5c7203111a007778d0cc5693ae7d
4
- data.tar.gz: 4442551d4003d8621131ccc5dcb2001586dfbaf8
3
+ metadata.gz: e578da17f40e6293cbf2b06d678604d9ea397db3
4
+ data.tar.gz: 589892bbad0c5b7d9c465b51496bb4474523f888
5
5
  SHA512:
6
- metadata.gz: 739c32babfb1933eaf57e75b6a9e916b9145a26dce322bbf10165ada460a9213018e0e89fec1b2fcf84c615f58e08be1e43d02c31a77485fd6ae72000b75ce6e
7
- data.tar.gz: b9e53414575a4f37c4cc5847d8ad912b3b2ba5e7b79f0b3f90852909bac1a359e84f8b53d1c71cf44d24a98763d2fc389c9670dcc0f1105e0dbf2a03e2ba6761
6
+ metadata.gz: 20fcbf7f247e61f52a02d5199069614d7dfd78a34122c8b0d510ad0b395b5559cb92f02a17a16425c80599fc199a3fb44ed210741bd41cf2eb63631235369f96
7
+ data.tar.gz: 48c47a62b81325b56468dd404771dd233c691b5b9e48482f88728830e9b14bb8d6b1c3f8ff071b06f897b63e3f3af80134954de422cc571646714992a37856ce
@@ -7,7 +7,7 @@ class Cutest
7
7
  autoload :Database, 'database'
8
8
 
9
9
  unless defined?(VERSION)
10
- VERSION = "1.4.0"
10
+ VERSION = "1.5.0"
11
11
  FILTER = %r[/(ruby|jruby|rbx)[-/]([0-9\.])+]
12
12
  CACHE = Hash.new { |h, k| h[k] = File.readlines(k) }
13
13
  end
@@ -128,6 +128,28 @@ class Cutest
128
128
  puts " → \033[0mfile: #{fn} ↪#{ln}\e[0m"
129
129
  puts " → \033[90mline: #{code(fn, ln)}\e[0m"
130
130
  end
131
+
132
+ def capture_output
133
+ old_stdout = STDOUT.clone
134
+ pipe_r, pipe_w = IO.pipe
135
+ pipe_r.sync = true
136
+ output = ""
137
+ reader = Thread.new do
138
+ begin
139
+ loop do
140
+ output << pipe_r.readpartial(1024)
141
+ end
142
+ rescue EOFError
143
+ end
144
+ end
145
+ STDOUT.reopen(pipe_w)
146
+ yield
147
+ ensure
148
+ STDOUT.reopen(old_stdout)
149
+ pipe_w.close
150
+ reader.join
151
+ return output
152
+ end
131
153
  end
132
154
 
133
155
  class Scope
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutest-cj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-10 00:00:00.000000000 Z
13
+ date: 2014-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pry