Sha256: 59bac22bd80c95325cd2e1d23c12ab607aa091c6391e99190ffc88f4f8c247c9
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module PiCharts # The Config class provides the interface to the config # for a chart. This is basically the skeleton of the # infromation that drives the infromation for the chart # that can be rendered into json. This information is # constructed with its +data+ which actually provides # the blueprints. class Config attr_accessor :data # The main brain and butter of what makes the co # The initialize() method handles the creation of what defines # the +data+ for a +config+, which sets up the relevant base. def initialize(args={}) @data = {} @data[:type] = '' @data[:data] = {} @data[:data][:datasets] = [] @data[:options] = {} end # type?() helps determine if a type has been set or not. def type? @data[:type].empty? ? false : true end # type() returns the the type set in the config, or false # if a type has not yet been set. def type @data[:type].empty? ? false : @data[:type] end # json() returns the +json+ representation of the +config+ data # in a javascript friendly form. Magic! def json @data.to_json end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pi_charts-1.0.0 | lib/pi_charts/config.rb |