Class: Steep::Interface::Method
- Inherits:
-
Object
- Object
- Steep::Interface::Method
- Defined in:
- lib/steep/interface/method.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#super_method ⇒ Object
readonly
Returns the value of attribute super_method.
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #closed? ⇒ Boolean
- #include_in_chain?(method) ⇒ Boolean
-
#initialize(type_name:, name:, types:, super_method:, attributes:) ⇒ Method
constructor
A new instance of Method.
- #map_types ⇒ Object
- #private? ⇒ Boolean
- #subst(s) ⇒ Object
- #with_super(super_method) ⇒ Object
- #with_types(types) ⇒ Object
Constructor Details
#initialize(type_name:, name:, types:, super_method:, attributes:) ⇒ Method
Returns a new instance of Method.
10 11 12 13 14 15 16 |
# File 'lib/steep/interface/method.rb', line 10 def initialize(type_name:, name:, types:, super_method:, attributes:) @type_name = type_name @name = name @types = types @super_method = super_method @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
8 9 10 |
# File 'lib/steep/interface/method.rb', line 8 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/steep/interface/method.rb', line 5 def name @name end |
#super_method ⇒ Object (readonly)
Returns the value of attribute super_method.
6 7 8 |
# File 'lib/steep/interface/method.rb', line 6 def super_method @super_method end |
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
4 5 6 |
# File 'lib/steep/interface/method.rb', line 4 def type_name @type_name end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
7 8 9 |
# File 'lib/steep/interface/method.rb', line 7 def types @types end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/steep/interface/method.rb', line 18 def ==(other) other.is_a?(Method) && other.type_name == type_name && other.name == name && other.types == types && other.super_method == super_method && other.attributes == attributes end |
#closed? ⇒ Boolean
31 32 33 |
# File 'lib/steep/interface/method.rb', line 31 def closed? types.all?(&:closed?) end |
#include_in_chain?(method) ⇒ Boolean
69 70 71 72 73 74 75 |
# File 'lib/steep/interface/method.rb', line 69 def include_in_chain?(method) (method.type_name == type_name && method.name == name && method.types == types && method.attributes == attributes) || super_method&.include_in_chain?(method) end |
#map_types ⇒ Object
65 66 67 |
# File 'lib/steep/interface/method.rb', line 65 def map_types with_types(types.map {|type| yield type }) end |
#private? ⇒ Boolean
27 28 29 |
# File 'lib/steep/interface/method.rb', line 27 def private? attributes.include?(:private) end |
#subst(s) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/steep/interface/method.rb', line 35 def subst(s) self.class.new( type_name: type_name, name: name, types: types.map {|type| type.subst(s) }, super_method: super_method&.subst(s), attributes: attributes ) end |
#with_super(super_method) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/steep/interface/method.rb', line 45 def with_super(super_method) self.class.new( type_name: type_name, name: name, types: types, super_method: super_method, attributes: attributes ) end |
#with_types(types) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/steep/interface/method.rb', line 55 def with_types(types) self.class.new( type_name: type_name, name: name, types: types, super_method: super_method, attributes: attributes ) end |