Class: Yoda::Model::FunctionSignatures::TypeBuilder
- Inherits:
-
Object
- Object
- Yoda::Model::FunctionSignatures::TypeBuilder
- Defined in:
- lib/yoda/model/function_signatures/type_builder.rb
Instance Attribute Summary collapse
- #parameters ⇒ ParameterList readonly
- #tag_list ⇒ Array<Store::Objects::Tag> readonly
Instance Method Summary collapse
-
#initialize(parameters, tag_list) ⇒ TypeBuilder
constructor
A new instance of TypeBuilder.
- #type ⇒ Types::FunctionType
- #type_of(param) ⇒ Types::Base
Constructor Details
#initialize(parameters, tag_list) ⇒ TypeBuilder
Returns a new instance of TypeBuilder.
14 15 16 17 |
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 14 def initialize(parameters, tag_list) @parameters = parameters @tag_list = tag_list end |
Instance Attribute Details
#parameters ⇒ ParameterList (readonly)
6 7 8 |
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 6 def parameters @parameters end |
#tag_list ⇒ Array<Store::Objects::Tag> (readonly)
9 10 11 |
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 9 def tag_list @tag_list end |
Instance Method Details
#type ⇒ Types::FunctionType
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 20 def type @type ||= begin if !.empty? parsed_type = parse_type_tag(.first) parsed_type.is_a?(Types::FunctionType) ? parsed_type : Types::FunctionType.new(return_type: parsed_type) else Types::FunctionType.new(return_type: return_types.first || Types::UnknownType.new('nodoc'), **) end end end |
#type_of(param) ⇒ Types::Base
33 34 35 |
# File 'lib/yoda/model/function_signatures/type_builder.rb', line 33 def type_of(param) param_type_table[param] || Types::UnknownType.new('nodoc') end |