Class: Clacky::UI2::Components::BaseComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/clacky/ui2/components/base_component.rb

Overview

BaseComponent provides common functionality for all UI components

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseComponent

Returns a new instance of BaseComponent.



10
11
12
# File 'lib/clacky/ui2/components/base_component.rb', line 10

def initialize
  @pastel = Pastel.new
end

Class Method Details

.render(data) ⇒ String

Class method to render without instantiating

Parameters:

  • data (Hash)

    Data to render

Returns:

  • (String)

    Rendered output



24
25
26
# File 'lib/clacky/ui2/components/base_component.rb', line 24

def self.render(data)
  new.render(data)
end

Instance Method Details

#render(data) ⇒ String

Render component with given data

Parameters:

  • data (Hash)

    Data to render

Returns:

  • (String)

    Rendered output

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/clacky/ui2/components/base_component.rb', line 17

def render(data)
  raise NotImplementedError, "Subclasses must implement render method"
end