File: component.rb

package info (click to toggle)
ruby-arbre 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 440 kB
  • sloc: ruby: 1,716; makefile: 7
file content (23 lines) | stat: -rw-r--r-- 404 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true
module Arbre
  class Component < Arbre::HTML::Div

    # By default components render a div
    def tag_name
      'div'
    end

    def initialize(*)
      super
      add_class default_class_name
    end

    protected

    # By default, add a css class named after the ruby class
    def default_class_name
      self.class.name.demodulize.underscore
    end

  end
end