Class: ChartJS::Opts

Inherits:
Object
  • Object
show all
Defined in:
lib/chart_js/chart/opts.rb

Instance Method Summary collapse

Constructor Details

#initializeOpts

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_hObject



19
20
21
# File 'lib/chart_js/chart/opts.rb', line 19

def to_h
  @container
end