Class: CLTupleType

Inherits:
CLType show all
Defined in:
lib/types/cl_tuple_type.rb

Direct Known Subclasses

CLTuple1Type, CLTuple2Type, CLTuple3Type

Constant Summary

Constants inherited from CLType

CLType::TAGS

Instance Method Summary collapse

Methods inherited from CLType

#get_cl_type_tag, #get_link_to, #get_tag_key, #get_tag_value, #get_tags, #tag_value_isvalid

Constructor Details

#initialize(data = nil) ⇒ CLTupleType

Returns a new instance of CLTupleType.



6
7
8
9
# File 'lib/types/cl_tuple_type.rb', line 6

def initialize(data = nil)
  super()  
  @data = data
end

Instance Method Details

#get_dataObject



26
27
28
# File 'lib/types/cl_tuple_type.rb', line 26

def get_data 
  @data
end

#to_jsonObject



30
31
32
# File 'lib/types/cl_tuple_type.rb', line 30

def to_json 
  to_string
end

#to_stringObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/types/cl_tuple_type.rb', line 11

def to_string
  if @data.size == 1
    @cl_type = CLTuple1Type.new
    @cl_type.to_string
  elsif @data.size == 2
    @cl_type = CLTuple2Type.new
    @cl_type.to_string
  elsif @data.size == 3
    @cl_type = CLTuple3Type.new
    @cl_type.to_string
  else
    raise "Invalid Type"
  end
end