Class: Yoda::Model::TypeExpressions::ModuleType
- Defined in:
- lib/yoda/model/type_expressions/module_type.rb
Instance Attribute Summary collapse
- #path ⇒ ScopedPath readonly
Instance Method Summary collapse
- #change_root(paths) ⇒ self
- #eql?(another) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(path) ⇒ ModuleType
constructor
A new instance of ModuleType.
- #resolve(registry) ⇒ Array<YARD::CodeObjects::Base>
- #to_rbs_type(env) ⇒ Object
- #to_s ⇒ String
Methods inherited from Base
Constructor Details
#initialize(path) ⇒ ModuleType
Returns a new instance of ModuleType.
9 10 11 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 9 def initialize(path) @path = ScopedPath.build(path) end |
Instance Attribute Details
#path ⇒ ScopedPath (readonly)
6 7 8 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 6 def path @path end |
Instance Method Details
#change_root(paths) ⇒ self
25 26 27 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 25 def change_root(paths) self.class.new(path.change_scope(paths)) end |
#eql?(another) ⇒ Boolean
14 15 16 17 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 14 def eql?(another) another.is_a?(ModuleType) && path == another.path end |
#hash ⇒ Object
19 20 21 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 19 def hash [self.class.name, path].hash end |
#resolve(registry) ⇒ Array<YARD::CodeObjects::Base>
31 32 33 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 31 def resolve(registry) [Store::Query::FindMetaClass.new(registry).find(path)].compact end |
#to_rbs_type(env) ⇒ Object
36 37 38 39 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 36 def to_rbs_type(env) name = env.resolve_rbs_type_name(path) name ? RBS::Types::Interface.new(name: name, args: [], location: nil) : RBS::Types::Bases::Any.new(location: nil) end |
#to_s ⇒ String
42 43 44 |
# File 'lib/yoda/model/type_expressions/module_type.rb', line 42 def to_s "#{path.path.to_s}.module" end |