redplot 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/redplot.rb +37 -39
- metadata +3 -3
data/lib/redplot.rb
CHANGED
@@ -1,31 +1,42 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
1
|
+
##
|
2
|
+
# Red Plot
|
3
|
+
#
|
4
|
+
# ( Gnuplot process wrapper )
|
5
|
+
#
|
6
|
+
# version 0.1.0
|
7
|
+
# author hugo benichi
|
8
|
+
# email hugo.benichi@m4x.org
|
9
|
+
# copyright 2012 hugo benichi
|
10
|
+
#
|
11
|
+
# reproduction
|
12
|
+
#
|
13
|
+
# You can use this code without restriction if you mention my name in your project.
|
14
|
+
# Other than that, you can redistribute and/or modify without restriction.
|
15
|
+
#
|
16
|
+
# description
|
17
|
+
#
|
18
|
+
# A simple layer wrapping around a gnuplot process.
|
19
|
+
# It gives convenience handler methods from and to Ruby objects
|
20
|
+
# Useful to quickly plot data produced inside Ruby.
|
21
|
+
#
|
22
|
+
# installation
|
23
|
+
#
|
24
|
+
# gem install redplot-x.y.z.gem
|
25
|
+
#
|
26
|
+
# wow it works:
|
27
|
+
#
|
28
|
+
# See lib/redplot/examples/;
|
29
|
+
# You can either mixin Redplot to any object
|
30
|
+
# You can also directly use the Plotter class
|
31
|
+
#
|
32
|
+
##
|
22
33
|
|
23
34
|
|
24
35
|
#main namespace
|
25
36
|
#also used for mixin
|
26
37
|
module RedPlot
|
27
38
|
|
28
|
-
VersionNumber, VersionDate = '0.0
|
39
|
+
VersionNumber, VersionDate = '0.1.0', '2012-06-05'
|
29
40
|
|
30
41
|
#helper class to store callbacks to the data and plot command options
|
31
42
|
class ToDraw
|
@@ -68,7 +79,10 @@ module RedPlot
|
|
68
79
|
end
|
69
80
|
|
70
81
|
def method_missing(*args)
|
71
|
-
|
82
|
+
#modification of "args" local var to auto-stringify fixnum
|
83
|
+
(scoped_header = @header ) << args.map{ |arg|
|
84
|
+
(arg.is_a? Numeric)? arg.to_s : arg #specifically this line
|
85
|
+
}.join(" ") + " "
|
72
86
|
args[0].to_s.tap do |eval_space|
|
73
87
|
eval_space.singleton_class.instance_eval do
|
74
88
|
define_method(:method_missing) do |*args|
|
@@ -215,20 +229,4 @@ module RedPlot
|
|
215
229
|
|
216
230
|
end
|
217
231
|
|
218
|
-
|
219
|
-
class Array
|
220
|
-
#this provide a quick hook for Array instances
|
221
|
-
def plot!(args={})
|
222
|
-
args[:as] ||= :plot
|
223
|
-
args[:in] = self.singleton_class
|
224
|
-
data = self
|
225
|
-
RedPlot::insert(args) { todraw.add args[:style] {data} }
|
226
|
-
wrapper = self.send args[:as]
|
227
|
-
end
|
228
|
-
#hook RedPlot to the array and draw what is inside it
|
229
|
-
def plot_now!(args={})
|
230
|
-
self.plot!(args).draw
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
232
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redplot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &7155680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *7155680
|
25
25
|
description: redplot gives convenience handler methods from and to Ruby objects to
|
26
26
|
easily communicate with a gnuplot process
|
27
27
|
email: hugo.benichi@m4x.org
|