class RBS::Types::Block

Attributes

required[R]
type[R]

Public Class Methods

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

Public Instance Methods

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