Class: Formidable::Elements::BasicElement

Inherits:
Object
  • Object
show all
Includes:
Rendering
Defined in:
lib/formidable/elements.rb

Direct Known Subclasses

Element, ElementList

Constant Summary

Constants included from Rendering

Rendering::RendererNotAssigned

Instance Attribute Summary collapse

Attributes included from Rendering

#renderer

Instance Method Summary collapse

Methods included from Rendering

included, #render

Constructor Details

#initialize(tag, name, attributes = Hash.new, raw_data = nil) ⇒ BasicElement

Returns a new instance of BasicElement.



15
16
17
18
19
# File 'lib/formidable/elements.rb', line 15

def initialize(tag, name, attributes = Hash.new, raw_data = nil)
  @tag, @name, @attributes = tag, name, attributes
  @attributes.merge!(name: name) if name
  self.raw_data = raw_data if raw_data
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



11
12
13
# File 'lib/formidable/elements.rb', line 11

def attributes
  @attributes
end

#cleaned_dataObject



21
22
23
# File 'lib/formidable/elements.rb', line 21

def cleaned_data
  @cleaned_data || self.raw_data
end

#contentObject

Returns the value of attribute content.



9
10
11
# File 'lib/formidable/elements.rb', line 9

def content
  @content
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/formidable/elements.rb', line 9

def name
  @name
end

#raw_dataObject

Returns the value of attribute raw_data.



9
10
11
# File 'lib/formidable/elements.rb', line 9

def raw_data
  @raw_data
end

#tagObject

Returns the value of attribute tag.



9
10
11
# File 'lib/formidable/elements.rb', line 9

def tag
  @tag
end