Class: RBS::Types::Record
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rbs/types.rb |
Class Method Summary
- .new(fields:, location:) ⇒ Record constructor
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(fields:, location:) ⇒ Record
Instance Attribute Details
#fields (readonly)
[ GitHub ]# File 'lib/rbs/types.rb', line 398
attr_reader :fields
#location (readonly)
[ GitHub ]# File 'lib/rbs/types.rb', line 399
attr_reader :location
Instance Method Details
#==(other) Also known as: #eql?
[ GitHub ]#each_type(&block)
[ GitHub ]# File 'lib/rbs/types.rb', line 446
def each_type(&block) if block fields.each_value(&block) else enum_for :each_type end end
#eql?(other)
[ GitHub ]# File 'lib/rbs/types.rb', line 410
alias eql? ==
#free_variables(set = Set.new)
[ GitHub ]#hash
[ GitHub ]# File 'lib/rbs/types.rb', line 412
def hash self.class.hash ^ fields.hash end
#map_type_name(&block)
[ GitHub ]#sub(s)
[ GitHub ]#to_json(state = _ = nil)
[ GitHub ]#to_s(level = 0)
[ GitHub ]# File 'lib/rbs/types.rb', line 433
def to_s(level = 0) return "{ }" if self.fields.empty? fields = self.fields.map do |key, type| if key.is_a?(Symbol) && key.match?(/\A[A-Za-z_][A-Za-z_]*\z/) && !key.match?(Parser::KEYWORDS_RE) "#{key}: #{type}" else "#{key.inspect} => #{type}" end end "{ #{fields.join(", ")} }" end