Class: Suricate::WidgetConfiguration
- Inherits:
-
Object
- Object
- Suricate::WidgetConfiguration
- Defined in:
- lib/suricate/configuration/widget_configuration.rb
Instance Attribute Summary collapse
-
#collector ⇒ Object
readonly
Returns the value of attribute collector.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(id, klass, collector, options = {}) ⇒ WidgetConfiguration
constructor
A new instance of WidgetConfiguration.
- #instantiate(context) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(id, klass, collector, options = {}) ⇒ WidgetConfiguration
Returns a new instance of WidgetConfiguration.
5 6 7 8 9 10 |
# File 'lib/suricate/configuration/widget_configuration.rb', line 5 def initialize(id, klass, collector, = {}) @id = id @klass = klass @collector = collector @options = end |
Instance Attribute Details
#collector ⇒ Object (readonly)
Returns the value of attribute collector.
3 4 5 |
# File 'lib/suricate/configuration/widget_configuration.rb', line 3 def collector @collector end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/suricate/configuration/widget_configuration.rb', line 3 def id @id end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
3 4 5 |
# File 'lib/suricate/configuration/widget_configuration.rb', line 3 def klass @klass end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/suricate/configuration/widget_configuration.rb', line 3 def @options end |
Instance Method Details
#instantiate(context) ⇒ Object
12 13 14 |
# File 'lib/suricate/configuration/widget_configuration.rb', line 12 def instantiate(context) @klass.new(id: id, context: context, collector: collector, options: ) end |
#to_h ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/suricate/configuration/widget_configuration.rb', line 16 def to_h { id: @id, type: @klass.type, configuration: @options } end |