Class: Steep::Interface::Abstract
- Inherits:
-
Object
- Object
- Steep::Interface::Abstract
- Defined in:
- lib/steep/interface/abstract.rb
Instance Attribute Summary collapse
-
#ivar_chains ⇒ Object
readonly
Returns the value of attribute ivar_chains.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#methods ⇒ Object
readonly
Returns the value of attribute methods.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#supers ⇒ Object
readonly
Returns the value of attribute supers.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name:, params:, methods:, supers:, ivar_chains:) ⇒ Abstract
constructor
A new instance of Abstract.
- #instantiate(type:, args:, instance_type:, module_type:) ⇒ Object
- #ivars ⇒ Object
Constructor Details
#initialize(name:, params:, methods:, supers:, ivar_chains:) ⇒ Abstract
Returns a new instance of Abstract.
11 12 13 14 15 16 17 |
# File 'lib/steep/interface/abstract.rb', line 11 def initialize(name:, params:, methods:, supers:, ivar_chains:) @name = name @params = params @methods = methods @supers = supers @ivar_chains = ivar_chains end |
Instance Attribute Details
#ivar_chains ⇒ Object (readonly)
Returns the value of attribute ivar_chains.
9 10 11 |
# File 'lib/steep/interface/abstract.rb', line 9 def ivar_chains @ivar_chains end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
5 6 7 |
# File 'lib/steep/interface/abstract.rb', line 5 def kind @kind end |
#methods ⇒ Object (readonly)
Returns the value of attribute methods.
7 8 9 |
# File 'lib/steep/interface/abstract.rb', line 7 def methods @methods end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/steep/interface/abstract.rb', line 4 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/steep/interface/abstract.rb', line 6 def params @params end |
#supers ⇒ Object (readonly)
Returns the value of attribute supers.
8 9 10 |
# File 'lib/steep/interface/abstract.rb', line 8 def supers @supers end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/steep/interface/abstract.rb', line 23 def ==(other) other.is_a?(self.class) && other.name == name && other.params == params && other.methods == methods && other.supers == supers && other.ivars == ivars end |
#instantiate(type:, args:, instance_type:, module_type:) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/steep/interface/abstract.rb', line 32 def instantiate(type:, args:, instance_type:, module_type:) Steep.logger.debug("type=#{type}, self=#{name}, args=#{args}, params=#{params}") subst = Substitution.build(params, args, instance_type: instance_type, module_type: module_type, self_type: type) Instantiated.new( type: type, methods: methods.transform_values {|method| method.subst(subst) }, ivar_chains: ivar_chains.transform_values {|chain| chain.subst(subst) } ) end |
#ivars ⇒ Object
19 20 21 |
# File 'lib/steep/interface/abstract.rb', line 19 def ivars @ivars ||= ivar_chains.transform_values(&:type) end |