Class: Taksi::Component

Inherits:
Module
  • Object
show all
Defined in:
lib/taksi/component.rb

Overview

A custom module to turn a class into a component on taksi protocol

“‘ruby

class CustomComponent
  include Taksi::Component.new('customs/component_name')

  content do
    field_name Taksi::Static
  end
end

“‘

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ Component

Returns a new instance of Component.



19
20
21
22
# File 'lib/taksi/component.rb', line 19

def initialize(identifier)
  @identifier = identifier
  super()
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



17
18
19
# File 'lib/taksi/component.rb', line 17

def identifier
  @identifier
end

Instance Method Details

#included(klass) ⇒ Object



24
25
26
27
28
29
# File 'lib/taksi/component.rb', line 24

def included(klass)
  klass.extend(ClassMethods)
  klass.include(InstanceMethods)

  klass.definition = self
end