examples/gruff/gruff_provider.rb in erlectricity-0.2.1 vs examples/gruff/gruff_provider.rb in erlectricity-1.0.0
- old
+ new
@@ -1,38 +1,31 @@
-$:.unshift(File.dirname(__FILE__) + "/../../lib/")
+$:.unshift File.join(File.dirname(__FILE__), *%w[../../lib])
+
require 'erlectricity'
require 'rubygems'
require 'gruff'
receive do |f|
-
-
-
- f.when(:plot, String, Symbol, String) do |name, style, font|
+ f.when([:plot, String, Symbol, String]) do |name, style, font|
graph = Gruff.const_get(style).new
graph.title = name
graph.font = font
graph.legend_font_size = 10
-
-
+
f.receive do |g|
- g.when(:data, Symbol, Array) do |name, points|
+ g.when([:data, Symbol, Array]) do |name, points|
graph.data name, points
g.receive_loop
end
-
- g.when(:labels, Erl.hash) do |label_data|
+
+ g.when([:labels, Erl.hash]) do |label_data|
graph.labels = label_data
g.receive_loop
end
-
- g.when(:end){ :ok }
+
+ g.when(:end) { :ok }
end
-
-
- f.send! :result, graph.to_blob
+
+ f.send!([:result, graph.to_blob])
f.receive_loop
end
-
-end
-
-
+end
\ No newline at end of file