Class: Deklarativna::Renderable
- Inherits:
-
Object
- Object
- Deklarativna::Renderable
- Defined in:
- lib/deklarativna_core.rb
Overview
Abstract Class Base Class for all renderables
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#tag_name ⇒ Object
Returns the value of attribute tag_name.
Instance Method Summary collapse
-
#initialize(&initialization_block) ⇒ Renderable
constructor
A new instance of Renderable.
-
#render_attributes ⇒ Object
Private Method This method renders the attributes for any Renderable class.
Constructor Details
#initialize(&initialization_block) ⇒ Renderable
Returns a new instance of Renderable.
8 9 10 |
# File 'lib/deklarativna_core.rb', line 8 def initialize &initialization_block initialization_block.call self end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/deklarativna_core.rb', line 6 def attributes @attributes end |
#tag_name ⇒ Object
Returns the value of attribute tag_name.
6 7 8 |
# File 'lib/deklarativna_core.rb', line 6 def tag_name @tag_name end |
Instance Method Details
#render_attributes ⇒ Object
Private Method This method renders the attributes for any Renderable class
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/deklarativna_core.rb', line 14 def render_attributes = [] attribute_list = @attributes.sort if @attributes.respond_to? :sort if attribute_list.respond_to? :each attribute_list.each do |e| .push "#{e[0]}=\"#{e[1]}\"" end end return " " + (.join " ") if !.empty? end |