Sha256: a90bcac5c5616171129439c5379e24233eba4182da52e34f3cc5d0b21343fe2c
Contents?: true
Size: 918 Bytes
Versions: 3
Compression:
Stored size: 918 Bytes
Contents
require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/hash/indifferent_access' module AmCharts class Settings delegate :[], :each, :fetch, to: :@settings def initialize @settings = {}.with_indifferent_access end def function(name) ChartBuilder::Function.new(name) end def literal(name) ChartBuilder::Literal.new(name) end def method_missing(name, *args, &block) if block_given? @settings[name] = block.call(*args) elsif name.to_s.end_with?('=') and args.length == 1 prefix = name.to_s.gsub(/=\z/, '') @settings[prefix] = args.first elsif !args.empty? @settings[name] = args.length == 1 ? args.first : args elsif name.to_s.end_with?('?') prefix = name.to_s.gsub(/\?\z/, '') @settings.key?(prefix) else @settings[name] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
amcharts.rb-3.4.7.0 | lib/amcharts/settings.rb |
amcharts.rb-3.2.0.2 | lib/amcharts/settings.rb |
amcharts.rb-3.2.0.1 | lib/amcharts/settings.rb |