Class: Cmdk::Separator

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

Overview

Visual and semantic separator. Port of ‘<Command.Separator>`. Hidden by the runtime while a search query is present, unless `always_render:`.

Constant Summary

Constants inherited from Base

Base::SR_ONLY_STYLE

Instance Method Summary collapse

Constructor Details

#initialize(always_render: false, **attributes) ⇒ Separator

Returns a new instance of Separator.



5
6
7
8
# File 'lib/cmdk/separator.rb', line 5

def initialize(always_render: false, **attributes)
  @always_render = always_render
  @attributes = attributes
end

Instance Method Details

#view_templateObject



10
11
12
13
14
# File 'lib/cmdk/separator.rb', line 10

def view_template
  defaults = { 'cmdk-separator' => '', role: 'separator' }
  defaults[:data] = { cmdk_always_render: '' } if @always_render
  div(**merged(defaults, @attributes))
end