Class: Steep::Interface::Shape::Entry
- Defined in:
- lib/steep/interface/shape.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
Instance Method Summary collapse
- #force ⇒ Object
- #has_method_type? ⇒ Boolean
-
#initialize(overloads: nil, private_method:, method_name:, &block) ⇒ Entry
constructor
A new instance of Entry.
- #method_types ⇒ Object
- #overloads ⇒ Object
- #private_method? ⇒ Boolean
- #public_method? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(overloads: nil, private_method:, method_name:, &block) ⇒ Entry
Returns a new instance of Entry.
55 56 57 58 59 60 |
# File 'lib/steep/interface/shape.rb', line 55 def initialize(overloads: nil, private_method:, method_name:, &block) @overloads = overloads @generator = block @private_method = private_method @method_name = method_name end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
53 54 55 |
# File 'lib/steep/interface/shape.rb', line 53 def method_name @method_name end |
Instance Method Details
#force ⇒ Object
62 63 64 65 66 67 |
# File 'lib/steep/interface/shape.rb', line 62 def force unless @overloads @overloads = @generator&.call @generator = nil end end |
#has_method_type? ⇒ Boolean
78 79 80 81 |
# File 'lib/steep/interface/shape.rb', line 78 def has_method_type? force @overloads ? true : false end |
#method_types ⇒ Object
74 75 76 |
# File 'lib/steep/interface/shape.rb', line 74 def method_types overloads.map(&:method_type) end |
#overloads ⇒ Object
69 70 71 72 |
# File 'lib/steep/interface/shape.rb', line 69 def overloads force @overloads or raise end |
#private_method? ⇒ Boolean
91 92 93 |
# File 'lib/steep/interface/shape.rb', line 91 def private_method? @private_method end |
#public_method? ⇒ Boolean
95 96 97 |
# File 'lib/steep/interface/shape.rb', line 95 def public_method? !private_method? end |
#to_s ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/steep/interface/shape.rb', line 83 def to_s if @generator "<< Lazy entry >>" else "{ #{method_types.join(" || ")} }" end end |