module ApexCharts::Prefixer

Public Class Methods

extended(helper) click to toggle source
# File lib/apex_charts/prefixer.rb, line 5
def self.extended(helper)
  @@helper = helper
end

Public Instance Methods

with_prefix(&block) click to toggle source
# File lib/apex_charts/prefixer.rb, line 9
def with_prefix(&block)
  @@prefixed = Module.new(&block)

  unless [nil, ''].include? ApexCharts.helper_prefix
    (@@prefixed.instance_methods - @@helper.instance_methods).each do |method|
      @@prefixed.send(:alias_method, "#{ApexCharts.helper_prefix}#{method}", method)
      @@prefixed.send(:remove_method, method)
    end
  end
  @@helper.send(:include, @@prefixed)
end