Class: EEML::Data

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

Overview

An EEML data item. A valid EEML::Environment must contain at least one of these.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, options = {}) ⇒ Data

Create a new EEML::Data item.



8
9
10
11
12
# File 'lib/eeml/data.rb', line 8

def initialize(value, options = {})
  @value = value
  @id = options[:id]
  @tags = []
end

Instance Attribute Details

#idObject

Data value



18
19
20
# File 'lib/eeml/data.rb', line 18

def id
  @id
end

#max_valueObject

Maximum value



27
28
29
# File 'lib/eeml/data.rb', line 27

def max_value
  @max_value
end

#min_valueObject

Minimum value



24
25
26
# File 'lib/eeml/data.rb', line 24

def min_value
  @min_value
end

#tagsObject

Tag array



21
22
23
# File 'lib/eeml/data.rb', line 21

def tags
  @tags
end

#valueObject

Data value



15
16
17
# File 'lib/eeml/data.rb', line 15

def value
  @value
end

Instance Method Details

#unitObject

Unit of measurement



30
31
32
# File 'lib/eeml/data.rb', line 30

def unit
  @unit
end

#unit=(unit_val) ⇒ Object

Unit of measurement - must be a EEML::Unit object



35
36
37
38
39
40
# File 'lib/eeml/data.rb', line 35

def unit=(unit_val)
  unless unit_val.is_a?(EEML::Unit)
    raise TypeError.new("unit must be an EEML::Unit") 
  end
  @unit = unit_val
end