Class: Rubord::Components::Separator

Inherits:
BaseComponent show all
Defined in:
lib/rubord/components/containers/separator.rb

Constant Summary collapse

SPACING =
{
  small: 1,
  large: 2
}.freeze

Instance Attribute Summary collapse

Attributes inherited from BaseComponent

#type

Instance Method Summary collapse

Constructor Details

#initialize(divider: true, spacing: :small) ⇒ Separator

Returns a new instance of Separator.



13
14
15
16
17
18
# File 'lib/rubord/components/containers/separator.rb', line 13

def initialize(divider: true, spacing: :small)
  super(14)

  @divider = !!divider
  @spacing = parse_spacing(spacing)
end

Instance Attribute Details

#dividerObject (readonly)

Returns the value of attribute divider.



11
12
13
# File 'lib/rubord/components/containers/separator.rb', line 11

def divider
  @divider
end

#spacingObject (readonly)

Returns the value of attribute spacing.



11
12
13
# File 'lib/rubord/components/containers/separator.rb', line 11

def spacing
  @spacing
end

Instance Method Details

#to_hObject



20
21
22
23
24
25
26
# File 'lib/rubord/components/containers/separator.rb', line 20

def to_h
  {
    type: @type,
    divider: @divider,
    spacing: @spacing
  }
end