Class: Tembin::Element::Base

Inherits:
Object
  • Object
show all
Extended by:
FieldDefinationMacros
Defined in:
lib/tembin/element/base.rb

Constant Summary

Constants included from FieldDefinationMacros

FieldDefinationMacros::AVAILABLE_TYPES

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FieldDefinationMacros

field

Constructor Details

#initialize(*args, &block) ⇒ Base

Returns a new instance of Base.



29
30
31
32
33
# File 'lib/tembin/element/base.rb', line 29

def initialize(*args, &block)
  @name = args[0]
  @block = block
  @attributes = {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



27
28
29
# File 'lib/tembin/element/base.rb', line 27

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/tembin/element/base.rb', line 27

def name
  @name
end

Class Method Details

.build(*args, &block) ⇒ Object



23
24
25
# File 'lib/tembin/element/base.rb', line 23

def self.build(*args, &block)
  new(*args, &block).build
end

Instance Method Details

#buildObject



35
36
37
38
# File 'lib/tembin/element/base.rb', line 35

def build
  instance_exec(&@block)
  self
end

#to_paramsObject

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/tembin/element/base.rb', line 40

def to_params
  raise NotImplementedError
end