Class: ForestAdminDatasourceToolkit::Components::Actions::ActionLayoutElement::BaseLayoutElement

Inherits:
Object
  • Object
show all
Defined in:
lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component:, **_kwargs) ⇒ BaseLayoutElement

Returns a new instance of BaseLayoutElement.



10
11
12
13
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 10

def initialize(component:, **_kwargs)
  @type = FieldType::LAYOUT
  @component = component
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component.



8
9
10
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 8

def component
  @component
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 8

def type
  @type
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
22
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 15

def to_h
  result = {}
  instance_variables.each do |attribute|
    result[attribute.to_s.delete('@').camelize(:lower).to_sym] = instance_variable_get(attribute)
  end

  result
end