class RBS::Types::Block

Attributes

required[R]
type[R]

Public Class Methods

new(type:, required:) click to toggle source
# File rbs-2.1.0/lib/rbs/types.rb, line 1024
def initialize(type:, required:)
  @type = type
  @required = required ? true : false
end

Public Instance Methods

==(other) click to toggle source
# File rbs-2.1.0/lib/rbs/types.rb, line 1029
def ==(other)
  other.is_a?(Block) &&
    other.type == type &&
    other.required == required
end
map_type(&block) click to toggle source
# File rbs-2.1.0/lib/rbs/types.rb, line 1049
def map_type(&block)
  Block.new(
    required: required,
    type: type.map_type(&block)
  )
end
sub(s) click to toggle source
# File rbs-2.1.0/lib/rbs/types.rb, line 1042
def sub(s)
  self.class.new(
    type: type.sub(s),
    required: required
  )
end
to_json(state = _ = nil) click to toggle source
# File rbs-2.1.0/lib/rbs/types.rb, line 1035
def to_json(state = _ = nil)
  {
    type: type,
    required: required
  }.to_json(state)
end