Class: Chemicalml::Model::Scalar

Inherits:
Node
  • Object
show all
Defined in:
lib/chemicalml/model/scalar.rb

Overview

A primitive scalar value with a data type and units.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#==, #accept, #children, #hash, short_name

Constructor Details

#initialize(value:, data_type: nil, units: nil, id: nil, title: nil, dict_ref: nil) ⇒ Scalar

Returns a new instance of Scalar.



9
10
11
12
13
14
15
16
17
# File 'lib/chemicalml/model/scalar.rb', line 9

def initialize(value:, data_type: nil, units: nil, id: nil,
               title: nil, dict_ref: nil)
  @value = value
  @data_type = data_type
  @units = units
  @id = id
  @title = title
  @dict_ref = dict_ref
end

Instance Attribute Details

#data_typeObject

Returns the value of attribute data_type.



7
8
9
# File 'lib/chemicalml/model/scalar.rb', line 7

def data_type
  @data_type
end

#dict_refObject

Returns the value of attribute dict_ref.



7
8
9
# File 'lib/chemicalml/model/scalar.rb', line 7

def dict_ref
  @dict_ref
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/chemicalml/model/scalar.rb', line 7

def id
  @id
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/chemicalml/model/scalar.rb', line 7

def title
  @title
end

#unitsObject

Returns the value of attribute units.



7
8
9
# File 'lib/chemicalml/model/scalar.rb', line 7

def units
  @units
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/chemicalml/model/scalar.rb', line 7

def value
  @value
end

Instance Method Details

#value_attributesObject



19
20
21
22
# File 'lib/chemicalml/model/scalar.rb', line 19

def value_attributes
  { value: value, data_type: data_type, units: units,
    id: id, title: title, dict_ref: dict_ref }
end