Class: Chemicalml::Model::Property

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

Overview

A named property that wraps a value (scalar/array/matrix) and points to a dictionary entry via dict_ref.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#==, #accept, #hash, short_name

Constructor Details

#initialize(value:, dict_ref:, id: nil, title: nil, convention: nil) ⇒ Property

Returns a new instance of Property.



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

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

Instance Attribute Details

#conventionObject

Returns the value of attribute convention.



8
9
10
# File 'lib/chemicalml/model/property.rb', line 8

def convention
  @convention
end

#dict_refObject

Returns the value of attribute dict_ref.



8
9
10
# File 'lib/chemicalml/model/property.rb', line 8

def dict_ref
  @dict_ref
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/chemicalml/model/property.rb', line 8

def id
  @id
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/chemicalml/model/property.rb', line 8

def title
  @title
end

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/chemicalml/model/property.rb', line 8

def value
  @value
end

Instance Method Details

#childrenObject



18
19
20
# File 'lib/chemicalml/model/property.rb', line 18

def children
  [value].compact
end

#value_attributesObject



22
23
24
25
# File 'lib/chemicalml/model/property.rb', line 22

def value_attributes
  { id: id, title: title, dict_ref: dict_ref,
    convention: convention, value: value }
end