chart-topper 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.md +5 -1
  2. data/lib/sinatra/chart_topper.rb +13 -6
  3. metadata +2 -2
data/README.md CHANGED
@@ -26,9 +26,13 @@ View your graph at [http://localhost/a\_graph\_of\_various\_fruit.png](http://lo
26
26
 
27
27
  ## Installation
28
28
 
29
+ To install Chart Topper
30
+
31
+ sudo gem install chart-topper
32
+
29
33
  Chart Topper is built around [Gruff](http://nubyonrails.com/pages/gruff) which is in turn built around [ImageMagick and RMagick](http://rmagick.rubyforge.org/install-osx.html).
30
34
 
31
- The quickest way to get all the ImageMagick dependancy installed is to use MacPorts (OS X).
35
+ The quickest way to get the ImageMagick dependancy installed is to use MacPorts (OS X).
32
36
 
33
37
  sudo port install imagemagick
34
38
 
@@ -11,12 +11,19 @@ module Sinatra
11
11
  :pie, :side_stacked_bar, :side_bar, :spider, :stacked_area, :stacked_bar]
12
12
 
13
13
  GRAPH_TYPES.each do |method|
14
- define_method(method) do |*args, &block|
15
- title, options = *args
16
- options ||= {}
17
- camelized = method.to_s.split('_').map {|w| w.capitalize}.join
18
- draw Gruff.const_get(camelized), title, options, &block
19
- end
14
+ # Ruby 1.8.6 doesn't seem to like this ???
15
+ # define_method(method) do |*args, &block|
16
+ # title, options = *args
17
+ # options ||= {}
18
+ # camelized = method.to_s.split('_').map {|w| w.capitalize}.join
19
+ # draw Gruff.const_get(camelized), title, options, &block
20
+ # end
21
+ camelized = method.to_s.split('_').map {|w| w.capitalize}.join
22
+ class_eval <<-EVAL
23
+ def #{method.to_s}(title, options ={}, &block)
24
+ draw #{Gruff.const_get(camelized)}, title, options, &block
25
+ end
26
+ EVAL
20
27
  end
21
28
 
22
29
  # Delegate(?) these methods to the graph
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chart-topper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Haynes
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-06-15 00:00:00 +01:00
12
+ date: 2010-06-16 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency