Class: DMN::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/dmn/variable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, type_ref:) ⇒ Variable

Returns a new instance of Variable.



11
12
13
14
15
# File 'lib/dmn/variable.rb', line 11

def initialize(id:, name:, type_ref:)
  @id = id
  @name = name
  @type_ref = type_ref
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/dmn/variable.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/dmn/variable.rb', line 5

def name
  @name
end

#type_refObject (readonly)

Returns the value of attribute type_ref.



5
6
7
# File 'lib/dmn/variable.rb', line 5

def type_ref
  @type_ref
end

Class Method Details

.from_json(json) ⇒ Object



7
8
9
# File 'lib/dmn/variable.rb', line 7

def self.from_json(json)
  Variable.new(id: json[:id], name: json[:name], type_ref: json[:type_ref])
end

Instance Method Details

#as_jsonObject



17
18
19
20
21
22
23
# File 'lib/dmn/variable.rb', line 17

def as_json
  {
    id: id,
    name: name,
    type_ref: type_ref,
  }
end