Class: CLString
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#from_bytes, #from_json, #to_bytes, #to_json
Constructor Details
#initialize(value) ⇒ CLString
11
12
13
14
15
16
|
# File 'lib/types/cl_string.rb', line 11
def initialize(value)
super()
raise "error" unless value.instance_of? String
@value = value
end
|
Instance Attribute Details
#cl_value ⇒ Object
Also known as:
clvalue?
Returns the value of attribute cl_value.
7
8
9
|
# File 'lib/types/cl_string.rb', line 7
def cl_value
@cl_value
end
|
Class Method Details
.to_bytes(clvalue) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/types/cl_string.rb', line 31
def self.to_bytes(clvalue)
value = clvalue.get_value
len = value.length
hex1 = len.to_s(16).rjust(8, '0').scan(/../).reverse.join('')
hex2 = value.unpack("H*").first
hex1 + hex2
end
|
Instance Method Details
#get_cl_type ⇒ Object
18
19
20
21
|
# File 'lib/types/cl_string.rb', line 18
def get_cl_type
@cl_string_type = CLStringType.new
@cl_string_type.to_string
end
|
#get_size ⇒ Object
27
28
29
|
# File 'lib/types/cl_string.rb', line 27
def get_size
@value.length
end
|
#get_value ⇒ Object
23
24
25
|
# File 'lib/types/cl_string.rb', line 23
def get_value
@value
end
|