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.
63 64 65 66 67 68 |
# File 'lib/steep/interface/shape.rb', line 63 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.
61 62 63 |
# File 'lib/steep/interface/shape.rb', line 61 def method_name @method_name end |
Instance Method Details
#force ⇒ Object
70 71 72 73 74 75 |
# File 'lib/steep/interface/shape.rb', line 70 def force unless @overloads @overloads = @generator&.call @generator = nil end end |
#has_method_type? ⇒ Boolean
86 87 88 89 |
# File 'lib/steep/interface/shape.rb', line 86 def has_method_type? force @overloads ? true : false end |
#method_types ⇒ Object
82 83 84 |
# File 'lib/steep/interface/shape.rb', line 82 def method_types overloads.map(&:method_type) end |
#overloads ⇒ Object
77 78 79 80 |
# File 'lib/steep/interface/shape.rb', line 77 def overloads force @overloads or raise end |
#private_method? ⇒ Boolean
99 100 101 |
# File 'lib/steep/interface/shape.rb', line 99 def private_method? @private_method end |
#public_method? ⇒ Boolean
103 104 105 |
# File 'lib/steep/interface/shape.rb', line 103 def public_method? !private_method? end |
#to_s ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/steep/interface/shape.rb', line 91 def to_s if @generator "<< Lazy entry >>" else "{ #{method_types.join(" || ")} }" end end |