Class: Rocx::Elements::Element

Inherits:
Object
  • Object
show all
Includes:
AttributeBuilder
Defined in:
lib/rocx/elements/element.rb

Constant Summary

Constants included from AttributeBuilder

AttributeBuilder::VALID_THEME_COLORS, AttributeBuilder::VALID_TYPES

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttributeBuilder

#attributes, included, #render?

Class Attribute Details

.property_nameObject (readonly)

Returns the value of attribute property_name.



7
8
9
# File 'lib/rocx/elements/element.rb', line 7

def property_name
  @property_name
end

Class Method Details

.name(*args) ⇒ Object



14
15
16
17
# File 'lib/rocx/elements/element.rb', line 14

def name(*args)
  @property_name = args.first if args.any?
  @name
end

.namespace(*args) ⇒ Object



19
20
21
22
# File 'lib/rocx/elements/element.rb', line 19

def namespace(*args)
  @namespace = args.first if args.any?
  @namespace
end

.tag(*args) ⇒ Object



9
10
11
12
# File 'lib/rocx/elements/element.rb', line 9

def tag(*args)
  @tag = args.first if args.any?
  @tag
end

Instance Method Details

#nameObject



30
31
32
# File 'lib/rocx/elements/element.rb', line 30

def name
  self.class.property_name || default_name
end

#namespaceObject



34
35
36
# File 'lib/rocx/elements/element.rb', line 34

def namespace
  self.class.namespace || default_namespace
end

#tagObject



26
27
28
# File 'lib/rocx/elements/element.rb', line 26

def tag
  self.class.tag || default_tag
end

#to_xml(xml) ⇒ Object



38
39
40
# File 'lib/rocx/elements/element.rb', line 38

def to_xml(xml)
  xml["w"].public_send(tag, xml_attributes)
end