class RBS::Types::Block

Attributes

required[R]
self_type[R]
type[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File rbs-2.8.2/lib/rbs/types.rb, line 1049
def ==(other)
  other.is_a?(Block) &&
    other.type == type &&
    other.required == required &&
    other.self_type == self_type
end
map_type() { |self_type| ... } click to toggle source
# File rbs-2.8.2/lib/rbs/types.rb, line 1072
def map_type(&block)
  Block.new(
    required: required,
    type: type.map_type(&block),
    self_type: self_type ? yield(self_type) : nil
  )
end
sub(s) click to toggle source
# File rbs-2.8.2/lib/rbs/types.rb, line 1064
def sub(s)
  self.class.new(
    type: type.sub(s),
    required: required,
    self_type: self_type&.sub(s)
  )
end
to_json(state = _ = nil) click to toggle source
# File rbs-2.8.2/lib/rbs/types.rb, line 1056
def to_json(state = _ = nil)
  {
    type: type,
    required: required,
    self_type: self_type
  }.to_json(state)
end