Class: Ea::Transformers::QeaToXmi::RunState::Binding

Inherits:
Struct
  • Object
show all
Defined in:
lib/ea/transformers/qea_to_xmi/run_state.rb

Overview

A single parsed RunState variable binding.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#opObject (readonly)

the operator character(s) EA stored



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ea/transformers/qea_to_xmi/run_state.rb', line 34

Binding = Struct.new(:variable, :value, :op) do
  # Sparx serialises the value with the operator character
  # prepended (`Op==` → `body="=Value"`). For other operators
  # (`!=`, `<`, `>`) the full operator string is prepended.
  #
  # @return [String] the body to set on the OpaqueExpression
  def body
    return value if op.nil? || op.empty?

    "#{op[0]}#{value}"
  end
end

#valueObject (readonly)

the literal value text



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ea/transformers/qea_to_xmi/run_state.rb', line 34

Binding = Struct.new(:variable, :value, :op) do
  # Sparx serialises the value with the operator character
  # prepended (`Op==` → `body="=Value"`). For other operators
  # (`!=`, `<`, `>`) the full operator string is prepended.
  #
  # @return [String] the body to set on the OpaqueExpression
  def body
    return value if op.nil? || op.empty?

    "#{op[0]}#{value}"
  end
end

#variableObject (readonly)

the attribute name on the classifier



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ea/transformers/qea_to_xmi/run_state.rb', line 34

Binding = Struct.new(:variable, :value, :op) do
  # Sparx serialises the value with the operator character
  # prepended (`Op==` → `body="=Value"`). For other operators
  # (`!=`, `<`, `>`) the full operator string is prepended.
  #
  # @return [String] the body to set on the OpaqueExpression
  def body
    return value if op.nil? || op.empty?

    "#{op[0]}#{value}"
  end
end

Instance Method Details

#bodyString

Sparx serialises the value with the operator character prepended (Op==body="=Value"). For other operators (!=, <, >) the full operator string is prepended.

Returns:

  • (String)

    the body to set on the OpaqueExpression



40
41
42
43
44
# File 'lib/ea/transformers/qea_to_xmi/run_state.rb', line 40

def body
  return value if op.nil? || op.empty?

  "#{op[0]}#{value}"
end