Class: ChartJS::Opts
- Inherits:
-
Object
- Object
- ChartJS::Opts
- Defined in:
- lib/chart_js/chart/opts.rb
Instance Method Summary collapse
- #build(&block) ⇒ Object
- #cutout(value = nil) ⇒ Object
-
#initialize ⇒ Opts
constructor
A new instance of Opts.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Opts
Returns a new instance of Opts.
5 6 7 |
# File 'lib/chart_js/chart/opts.rb', line 5 def initialize @container = Hash.new end |
Instance Method Details
#build(&block) ⇒ Object
9 10 11 12 |
# File 'lib/chart_js/chart/opts.rb', line 9 def build(&block) instance_eval(&block) @container end |
#cutout(value = nil) ⇒ Object
14 15 16 17 |
# File 'lib/chart_js/chart/opts.rb', line 14 def cutout(value = nil) return @container['cutoutPercentage'] if value.nil? @container['cutoutPercentage'] = value end |
#to_h ⇒ Object
19 20 21 |
# File 'lib/chart_js/chart/opts.rb', line 19 def to_h @container end |