Class: RubyUI::Separator

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_ui/separator/separator.rb

Constant Summary collapse

ORIENTATIONS =
%i[horizontal vertical].freeze

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(as: :div, orientation: :horizontal, decorative: true, **attrs) ⇒ Separator

Returns a new instance of Separator.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
# File 'lib/ruby_ui/separator/separator.rb', line 7

def initialize(as: :div, orientation: :horizontal, decorative: true, **attrs)
  raise ArgumentError, "Invalid orientation: #{orientation}" unless ORIENTATIONS.include?(orientation.to_sym)

  @as = as
  @orientation = orientation.to_sym
  @decorative = decorative
  super(**attrs)
end

Instance Method Details

#view_templateObject



16
17
18
# File 'lib/ruby_ui/separator/separator.rb', line 16

def view_template(&)
  tag(@as, **attrs, &)
end