Sha256: d5f33a8eb551100abb22843b4b3835f29c6fe20313fa5af1a78b806d15f5e1ed
Contents?: true
Size: 783 Bytes
Versions: 3
Compression:
Stored size: 783 Bytes
Contents
module ForestAdminDatasourceToolkit class Datasource < Components::Contracts::DatasourceContract attr_reader :collections, :charts def initialize super @charts = {} @collections = {} end def collection(name) raise Exceptions::ForestException, "Collection #{name} not found." unless @collections.key? name @collections[name] end def add_collection(collection) if @collections.key? collection.name raise Exceptions::ForestException, "Collection #{collection.name} already defined in datasource" end @collections[collection.name] = collection end def render_chart(_caller, name) raise Exceptions::ForestException, "No chart named #{name} exists on this datasource." end end end
Version data entries
3 entries across 3 versions & 1 rubygems