simpler 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History +5 -1
- data/VERSION +1 -1
- data/lib/simpler.rb +7 -15
- metadata +2 -2
data/History
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/simpler.rb
CHANGED
@@ -69,20 +69,6 @@ class Simpler
|
|
69
69
|
Simpler::Reply.new(reply)
|
70
70
|
end
|
71
71
|
|
72
|
-
# pushes string onto command array (if given), executes all commands, and
|
73
|
-
# clears the command array.
|
74
|
-
def run!(string=nil)
|
75
|
-
@commands.push(string) if string
|
76
|
-
reply = nil
|
77
|
-
Open3.popen3("Rscript -") do |stdin, stdout, stderr|
|
78
|
-
stdin.puts @commands.map {|v| v + "\n"}.join
|
79
|
-
stdin.close_write
|
80
|
-
reply = stdout.read
|
81
|
-
end
|
82
|
-
@commands.clear
|
83
|
-
Simpler::Reply.new(reply)
|
84
|
-
end
|
85
|
-
|
86
72
|
# returns self for chaining
|
87
73
|
def with(*objects, &block)
|
88
74
|
var_names = objects.map {|v| Simpler.varname(v) }
|
@@ -91,9 +77,15 @@ class Simpler
|
|
91
77
|
@commands << block.call(*var_names)
|
92
78
|
self
|
93
79
|
end
|
80
|
+
|
81
|
+
def show_with!(*objects, &block)
|
82
|
+
with(*objects, &block).show!
|
83
|
+
end
|
94
84
|
|
95
|
-
def
|
85
|
+
def run_with!(*objects, &block)
|
96
86
|
with(*objects, &block).run!
|
97
87
|
end
|
98
88
|
|
89
|
+
alias_method :go!, :run_with!
|
90
|
+
|
99
91
|
end
|