Class: SpotFeel::Dmn::Input

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, label:, input_expression:) ⇒ Input

Returns a new instance of Input.



13
14
15
16
17
# File 'lib/spot_feel/dmn/input.rb', line 13

def initialize(id:, label:, input_expression:)
  @id = id
  @label = label
  @input_expression = input_expression
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/spot_feel/dmn/input.rb', line 6

def id
  @id
end

#input_expressionObject (readonly)

Returns the value of attribute input_expression.



6
7
8
# File 'lib/spot_feel/dmn/input.rb', line 6

def input_expression
  @input_expression
end

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'lib/spot_feel/dmn/input.rb', line 6

def label
  @label
end

Class Method Details

.from_json(json) ⇒ Object



8
9
10
11
# File 'lib/spot_feel/dmn/input.rb', line 8

def self.from_json(json)
  input_expression = LiteralExpression.from_json(json[:input_expression]) if json[:input_expression]
  Input.new(id: json[:id], label: json[:label], input_expression:)
end

Instance Method Details

#as_jsonObject



19
20
21
22
23
24
25
# File 'lib/spot_feel/dmn/input.rb', line 19

def as_json
  {
    id: id,
    label: label,
    input_expression: input_expression.as_json,
  }
end