File tree Expand file tree Collapse file tree 3 files changed +22
-9
lines changed Expand file tree Collapse file tree 3 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ All notable changes to this project will be documented in this file.
16
16
- Chart options set globally not showing as default options
17
17
- Chart height options not overriden by default options
18
18
19
+ ### Deprecated
20
+ - Using Sinatra helper name ` Sinatra::ApexCharts ` . No need to call
21
+ anything after requiring 'apexcharts' now.
22
+
19
23
## [ 0.2.0] - 2022-02-28
20
24
### Added
21
25
- Option to render chart with a script whose type is module
Original file line number Diff line number Diff line change 1
1
### Sinatra
2
2
3
- Require it after you ` require 'sinatra/base' ` and add helper ` Sinatra::ApexCharts ` in the
4
- class that inherits from ` Sinatra::Base ` .
3
+ Require it after you ` require 'sinatra/base' ` .
5
4
6
5
``` ruby
7
6
require ' sinatra/base'
8
7
require ' apexcharts'
9
-
10
- class SimpleApp < Sinatra ::Base
11
- helpers Sinatra ::ApexCharts
12
- end
13
8
```
14
9
15
10
To add the asset (ApexCharts.JS), include a script tag in your template
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
module Sinatra
4
- module ApexCharts
5
- include ::ApexCharts ::Helper
4
+ def self . const_missing ( const_name )
5
+ if const_name == :ApexCharts
6
+ warn "[DEPRECATION] specifying `Sinatra::#{ const_name } ` as " \
7
+ 'helper is deprecated and will raise an error in next ' \
8
+ 'release. Requiring ApexCharts (`require "apexcharts"`) ' \
9
+ 'is enough to use its chart helper methods.'
10
+ ::ApexCharts ::SinatraHelper
11
+ else
12
+ super
13
+ end
6
14
end
15
+ end
7
16
8
- helpers ApexCharts
17
+ module ApexCharts
18
+ module SinatraHelper
19
+ include ::ApexCharts ::Helper
20
+ end
9
21
end
22
+
23
+ Sinatra ::Base . helpers ApexCharts ::SinatraHelper
You can’t perform that action at this time.
0 commit comments