Class: Google::Visualization::DataElement

Inherits:
Object
  • Object
show all
Defined in:
lib/google_visualization/data_element.rb

Overview

DataElement

Description

Represents a element that holds a set of custom properties (name/value pairs).

Direct Known Subclasses

DataCell, DataColumn, DataRow, DataTable

Instance Method Summary collapse

Constructor Details

#initializeDataElement

Creates a new data element.



16
17
18
# File 'lib/google_visualization/data_element.rb', line 16

def initialize
  @custom_properties = {}
end

Instance Method Details

#custom_propertiesObject

Returns a enumerable of all properties.



38
39
40
# File 'lib/google_visualization/data_element.rb', line 38

def custom_properties
  @custom_properties.to_enum
end

#custom_properties_countObject

Returns the number of custom properties.



23
24
25
# File 'lib/google_visualization/data_element.rb', line 23

def custom_properties_count
  @custom_properties.size
end

#custom_property(name) ⇒ Object

Returns the value of a named property, or nil if no such property is set.



31
32
33
# File 'lib/google_visualization/data_element.rb', line 31

def custom_property(name)
  @custom_properties[name]
end

#store_custom_properties(hash) ⇒ Object

Sets multiple properties.



52
53
54
# File 'lib/google_visualization/data_element.rb', line 52

def store_custom_properties(hash)
  @custom_properties.merge!(hash)
end

#store_custom_property(name, value) ⇒ Object

Sets a single property.



45
46
47
# File 'lib/google_visualization/data_element.rb', line 45

def store_custom_property(name, value)
  @custom_properties[name] = value
end