Sha256: 87100d90be26911ceeb8447d277041cb1dc815ae7c892bbaac7c98064e4b35bc

Contents?: true

Size: 507 Bytes

Versions: 3

Compression:

Stored size: 507 Bytes

Contents

module Suricate
  class WidgetConfiguration
    attr_reader  :id, :klass, :collector, :options

    def initialize(id, klass, collector, options = {})
      @id        = id
      @klass     = klass
      @collector = collector
      @options   = options
    end

    def instantiate(context)
      @klass.new(id: id, context: context, collector: collector, options: options)
    end

    def to_h
      {
        id: @id,
        type: @klass.type,
        configuration: @options
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
suricate-0.0.4 lib/suricate/configuration/widget_configuration.rb
suricate-0.0.3 lib/suricate/configuration/widget_configuration.rb
suricate-0.0.2 lib/suricate/configuration/widget_configuration.rb