Class: Ambling::Data::BaseValue

Inherits:
Object
  • Object
show all
Defined in:
lib/ambling/data.rb

Overview

A data point in the XML has a value and attributes

Direct Known Subclasses

Message, Point, Slice, Value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, attributes = {}) ⇒ BaseValue

Returns a new instance of BaseValue.



25
26
27
28
# File 'lib/ambling/data.rb', line 25

def initialize(value, attributes={})
  @value = value
  @attributes = attributes
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



23
24
25
# File 'lib/ambling/data.rb', line 23

def attributes
  @attributes
end

#valueObject

Returns the value of attribute value.



23
24
25
# File 'lib/ambling/data.rb', line 23

def value
  @value
end

Instance Method Details

#build_xml(builder) ⇒ Object



40
41
42
# File 'lib/ambling/data.rb', line 40

def build_xml(builder)
  builder.tag!(tag_name, @value, @attributes)
end

#tag_nameObject



36
37
38
# File 'lib/ambling/data.rb', line 36

def tag_name
  "value"
end

#to_xml(builder = nil) ⇒ Object



30
31
32
33
34
# File 'lib/ambling/data.rb', line 30

def to_xml(builder = nil)
  builder ||= Builder::XmlMarkup.new
  build_xml(builder)
  builder.target!
end