Class: OpenC3::PythonProxy

Inherits:
Object show all
Defined in:
lib/openc3/utilities/python_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, class_name, *params) ⇒ PythonProxy

Returns a new instance of PythonProxy.



22
23
24
25
26
27
28
29
30
31
# File 'lib/openc3/utilities/python_proxy.rb', line 22

def initialize(type, class_name, *params)
  @type = type
  @class_name = class_name
  @params = params
  @args = params
  @name = nil
  @converted_type = nil
  @converted_bit_size = nil
  @converted_array_size = nil
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



17
18
19
# File 'lib/openc3/utilities/python_proxy.rb', line 17

def args
  @args
end

#converted_array_sizeObject

Returns the value of attribute converted_array_size.



20
21
22
# File 'lib/openc3/utilities/python_proxy.rb', line 20

def converted_array_size
  @converted_array_size
end

#converted_bit_sizeObject

Returns the value of attribute converted_bit_size.



19
20
21
# File 'lib/openc3/utilities/python_proxy.rb', line 19

def converted_bit_size
  @converted_bit_size
end

#converted_typeObject

Returns the value of attribute converted_type.



18
19
20
# File 'lib/openc3/utilities/python_proxy.rb', line 18

def converted_type
  @converted_type
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/openc3/utilities/python_proxy.rb', line 16

def name
  @name
end

Instance Method Details

#as_json(*args, **kw_args) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/openc3/utilities/python_proxy.rb', line 37

def as_json(*args, **kw_args)
  case @type
  when "Processor"
    return { 'name' => @name, 'class' => @class_name, 'params' => @params }
  when "Conversion"
    result = { 'class' => @class_name, 'params' => @params }
    result['converted_type'] = @converted_type.to_s if @converted_type
    result['converted_bit_size'] = @converted_bit_size if @converted_bit_size
    result['converted_array_size'] = @converted_array_size if @converted_array_size
    return result
  when "LimitsResponse"
    return { "class" => @class_name, 'params' => @params }
  else
    raise "Unknown PythonProxy type: #{@type}"
  end
end

#classObject



33
34
35
# File 'lib/openc3/utilities/python_proxy.rb', line 33

def class
  return @class_name
end