Class: Yoda::Model::TypeExpressions::DuckType
- Defined in:
- lib/yoda/model/type_expressions/duck_type.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
Instance Method Summary collapse
- #change_root(paths) ⇒ self
- #eql?(another) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(method_name) ⇒ DuckType
constructor
A new instance of DuckType.
- #resolve(registry) ⇒ Array<Store::Objects::Base>
- #to_rbs_type(env) ⇒ Object
- #to_s ⇒ String
Methods inherited from Base
Constructor Details
#initialize(method_name) ⇒ DuckType
Returns a new instance of DuckType.
8 9 10 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 8 def initialize(method_name) @method_name = method_name end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
5 6 7 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 5 def method_name @method_name end |
Instance Method Details
#change_root(paths) ⇒ self
24 25 26 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 24 def change_root(paths) self end |
#eql?(another) ⇒ Boolean
13 14 15 16 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 13 def eql?(another) another.is_a?(DuckType) && method_name == another.method_name end |
#hash ⇒ Object
18 19 20 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 18 def hash [self.class.name, method_name].hash end |
#resolve(registry) ⇒ Array<Store::Objects::Base>
30 31 32 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 30 def resolve(registry) [] end |
#to_rbs_type(env) ⇒ Object
35 36 37 38 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 35 def to_rbs_type(env) # TODO: Implement as interface type RBS::Types::Bases::Any.new(location: nil) end |
#to_s ⇒ String
41 42 43 |
# File 'lib/yoda/model/type_expressions/duck_type.rb', line 41 def to_s "##{method_name}" end |