Class: TRuby::UnionTypeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/t_ruby/union_type_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(type_string) ⇒ UnionTypeParser



5
6
7
# File 'lib/t_ruby/union_type_parser.rb', line 5

def initialize(type_string)
  @type_string = type_string.strip
end

Instance Method Details

#parseObject



9
10
11
12
13
14
15
16
# File 'lib/t_ruby/union_type_parser.rb', line 9

def parse
  # Check if it contains pipes (union indicator)
  if @type_string.include?("|")
    parse_union
  else
    parse_simple
  end
end