compendium 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGJkNWVkYjI2YzZhZDYxOWVlODRkYTRhZWEyMGZjZWE5M2JkNTQwMA==
4
+ MjZkMmY3MmZhNjk4YzdjMmRkZTBiZDcyZjMwYjUyNjU2MDFmMjM1YQ==
5
5
  data.tar.gz: !binary |-
6
- ODlmZmY3MWJmYzFkNzJkNWIzYWZkYWNhN2M5NGNkOWFmZGZlYjhkMQ==
6
+ N2IxZDJkYzJkNjJkMzYxMGU2OWYwOTQ0NjA2NzdlYmI4ODJjYjQwNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDE4YmNmMzkwZWY4ZTI4ZTliYjdjYTI5NWI1MmE4ZGM0NTBkYWQ3YzQxZWJi
10
- ZjU2NmJhZWQzNmRlNDZjZjM5MWQ4ZjdiODdmMmY4YWEyYTc4ZmU1NmZhOTNh
11
- YTkyMDA2OWZkODRjZDExYjhhN2FkOGE1Y2Y5MDM2MmFkODlmN2U=
9
+ MGVhNDY5ZTViNWJiYzJlMmM4NjY1MGNiNzcxYjNhMzdlODE2ZGYxN2U1ZjI5
10
+ YzkwMzg1OTkzMzUyYTc5MjdkYmUyNDFjNmVmNGZjOGFiOWZiZDY1YzNmNGIz
11
+ YzQ0MGM1NjA2YTcxMmVlMDUzOWI2ZmU2NGVlNTk1ZTYzOTZiZWU=
12
12
  data.tar.gz: !binary |-
13
- YzYwMWVkNzIzNzdhZDA0NDUyMTYyMTZiMjA2YWJmYTU2NzY0OTNjNGUzYWM5
14
- ZDU0YTUwNDgxNDgyNTVkMzI2ODFhMzdmMDM5MGQzNDcwNzBmMDgwYzM4OTc0
15
- NWVlNzY2N2I3ZGQ1NWViMGEwMzZkNjhlNTFmZTIwOWFhMjViMzM=
13
+ YjQ2MjJmMTViNGU4NDZhYjU2ZDA4OTAwOGMzOGM1MjEyMzQ4NDBlZmJiMTcx
14
+ YzU4N2U2NzhmOTMzNDJiODgxYzQxYWQ2NzI0NjA0ZmIzM2U4ODEyMTZlOWZh
15
+ NDBkMzRiMGU2YTczNWE2YmQyNDIzMjExZDZlNDdjYzlkYmFjZjQ=
@@ -36,6 +36,7 @@ module Compendium::Presenters
36
36
 
37
37
  def provider
38
38
  provider = Compendium.config.chart_provider
39
+ require "compendium/#{provider.downcase}"
39
40
  provider.is_a?(Class) ? provider : Compendium::ChartProvider.const_get(provider)
40
41
  end
41
42
 
@@ -69,5 +70,15 @@ module Compendium::Presenters
69
70
  return {} unless protected_against_csrf?
70
71
  { @template.controller.request_forgery_protection_token => @template.controller.send(:form_authenticity_token) }
71
72
  end
73
+
74
+ def method_missing(name, *args, &block)
75
+ return chart_provider.send(name, *args, &block) if chart_provider.respond_to?(name)
76
+ super
77
+ end
78
+
79
+ def respond_to_missing?(name, include_private = false)
80
+ return true if chart_provider.respond_to?(name)
81
+ super
82
+ end
72
83
  end
73
84
  end
@@ -5,6 +5,8 @@ module Compendium
5
5
  # To add a new chart provider, #initialize and #render must be implemented
6
6
  # Custom providers should also override Compendium::AbstractChartProvider.find_chart_provider (but fallback to super)
7
7
 
8
+ module ChartProvider; end
9
+
8
10
  class AbstractChartProvider
9
11
  attr_reader :chart
10
12
 
@@ -25,5 +27,17 @@ module Compendium
25
27
  def self.find_chart_provider
26
28
  nil
27
29
  end
30
+
31
+ private
32
+
33
+ def method_missing(name, *args, &block)
34
+ return chart.send(name, *args, &block) if chart.respond_to?(name)
35
+ super
36
+ end
37
+
38
+ def respond_to_missing?(name, include_private = false)
39
+ return true if chart.respond_to?(name)
40
+ super
41
+ end
28
42
  end
29
43
  end
@@ -56,10 +56,16 @@ module Compendium
56
56
  Compendium::Presenters::Table.new(template, self, *options, &block).render unless empty?
57
57
  end
58
58
 
59
+ # Allow access to the chart object without having to explicitly render it
60
+ def chart(template, *options, &block)
61
+ # Access the actual chart object
62
+ Compendium::Presenters::Chart.new(template, self, *options, &block)
63
+ end
64
+
59
65
  def render_chart(template, *options, &block)
60
66
  # A query can be rendered regardless of if it has data or not
61
67
  # Rendering a chart with no result set builds a chart scaffold which can be updated through AJAX
62
- Compendium::Presenters::Chart.new(template, self, *options, &block).render
68
+ chart(template, *options, &block).render
63
69
  end
64
70
 
65
71
  def ran?
@@ -1,3 +1,3 @@
1
1
  module Compendium
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compendium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Vandersluis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-07 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  type: :runtime