Class: Yoda::Model::FunctionSignatures::TypeBuilder::TypeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/model/function_signatures/type_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ TypeParser

Returns a new instance of TypeParser.

Parameters:



103
104
105
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 103

def initialize(tag)
  @tag = tag
end

Instance Attribute Details

#tagObject (readonly)

Returns the value of attribute tag.



100
101
102
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 100

def tag
  @tag
end

Instance Method Details

#typeTypeExpressions::Base



108
109
110
111
112
113
114
115
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 108

def type
  # yard tag may not have any type literals.
  if (tag.yard_types || []).empty?
    TypeExpressions::UnknownType.new('nodoc') 
  else
    TypeExpressions.parse_type_strings(tag.yard_types).change_root(convert_lexical_scope_literals(tag.lexical_scope))
  end
end

#type_of_type_tagTypeExpressions::Base



118
119
120
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 118

def type_of_type_tag
  Parsing::TypeParser.new.safe_parse(tag.text).change_root(convert_lexical_scope_literals(tag.lexical_scope))
end