class Parlour::Types::Record
A record/shape; a hash with a fixed set of keys with given types.
Attributes
keys_to_types[R]
Public Class Methods
new(keys_to_types)
click to toggle source
# File lib/parlour/types.rb, line 371 def initialize(keys_to_types) @keys_to_types = keys_to_types.map do |k, v| [k, to_type(v)] end.to_h end
Public Instance Methods
==(other)
click to toggle source
# File lib/parlour/types.rb, line 378 def ==(other) Record === other && keys_to_types == other.keys_to_types end
describe()
click to toggle source
# File lib/parlour/types.rb, line 396 def describe "{ #{keys_to_types.map { |k, v| "#{k}: #{v.describe}" }.join(', ')} }" end
generate_rbi()
click to toggle source
# File lib/parlour/types.rb, line 386 def generate_rbi "{ #{keys_to_types.map { |k, v| "#{k}: #{v.generate_rbi}" }.join(', ')} }" end
generate_rbs()
click to toggle source
# File lib/parlour/types.rb, line 391 def generate_rbs "{ #{keys_to_types.map { |k, v| "#{k}: #{v.generate_rbs}" }.join(', ')} }" end