Module: RBS::Types::Application
- Included in:
- Alias, ClassInstance, ClassSingleton, Interface
- Defined in:
- lib/rbs/types.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #each_type(&block) ⇒ Object
- #free_variables(set = Set.new) ⇒ Object
- #has_classish_type? ⇒ Boolean
- #has_self_type? ⇒ Boolean
- #hash ⇒ Object
- #to_s(level = 0) ⇒ Object
- #with_nonreturn_void? ⇒ Boolean
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
204 205 206 |
# File 'lib/rbs/types.rb', line 204 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
203 204 205 |
# File 'lib/rbs/types.rb', line 203 def name @name end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
206 207 208 |
# File 'lib/rbs/types.rb', line 206 def ==(other) other.is_a?(self.class) && other.name == name && other.args == args end |
#each_type(&block) ⇒ Object
232 233 234 235 236 237 238 |
# File 'lib/rbs/types.rb', line 232 def each_type(&block) if block args.each(&block) else enum_for :each_type end end |
#free_variables(set = Set.new) ⇒ Object
216 217 218 219 220 221 222 |
# File 'lib/rbs/types.rb', line 216 def free_variables(set = Set.new) set.tap do args.each do |arg| arg.free_variables(set) end end end |
#has_classish_type? ⇒ Boolean
244 245 246 |
# File 'lib/rbs/types.rb', line 244 def has_classish_type? each_type.any? {|type| type.has_classish_type? } end |
#has_self_type? ⇒ Boolean
240 241 242 |
# File 'lib/rbs/types.rb', line 240 def has_self_type? each_type.any? {|type| type.has_self_type? } end |
#hash ⇒ Object
212 213 214 |
# File 'lib/rbs/types.rb', line 212 def hash name.hash ^ args.hash end |
#to_s(level = 0) ⇒ Object
224 225 226 227 228 229 230 |
# File 'lib/rbs/types.rb', line 224 def to_s(level = 0) if args.empty? name.to_s else "#{name}[#{args.join(", ")}]" end end |
#with_nonreturn_void? ⇒ Boolean
248 249 250 251 252 253 254 255 256 257 |
# File 'lib/rbs/types.rb', line 248 def with_nonreturn_void? each_type.any? do |type| if type.is_a?(Bases::Void) # `void` in immediate generics parameter is allowed false else type.with_nonreturn_void? # steep:ignore DeprecatedReference end end end |