123456789_123456789_123456789_123456789_123456789_

Class: RBS::DefinitionBuilder::AncestorBuilder::OneAncestors

Relationships & Source Files
Inherits: Object
Defined in: lib/rbs/definition_builder/ancestor_builder.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(type_name:, params:, super_class:, self_types:, included_modules:, included_interfaces:, prepended_modules:, extended_modules:, extended_interfaces:) ⇒ OneAncestors

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 15

def initialize(type_name:, params:, super_class:, self_types:, included_modules:, included_interfaces:, prepended_modules:, extended_modules:, extended_interfaces:)
  @type_name = type_name
  @params = params
  @super_class = super_class
  @self_types = self_types
  @included_modules = included_modules
  @included_interfaces = included_interfaces
  @prepended_modules = prepended_modules
  @extended_modules = extended_modules
  @extended_interfaces = extended_interfaces
end

Class Method Details

.class_instance(type_name:, params:, super_class:)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 92

def self.class_instance(type_name:, params:, super_class:)
  new(
    type_name: type_name,
    params: params,
    super_class: super_class,
    self_types: nil,
    included_modules: [],
    included_interfaces: [],
    prepended_modules: [],
    extended_modules: nil,
    extended_interfaces: nil
  )
end

.interface(type_name:, params:)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 134

def self.interface(type_name:, params:)
  new(
    type_name: type_name,
    params: params,
    self_types: nil,
    included_modules: nil,
    included_interfaces: [],
    prepended_modules: nil,
    super_class: nil,
    extended_modules: nil,
    extended_interfaces: nil
  )
end

.module_instance(type_name:, params:)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 120

def self.module_instance(type_name:, params:)
  new(
    type_name: type_name,
    params: params,
    self_types: [],
    included_modules: [],
    included_interfaces: [],
    prepended_modules: [],
    super_class: nil,
    extended_modules: nil,
    extended_interfaces: nil
  )
end

.singleton(type_name:, super_class:)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 106

def self.singleton(type_name:, super_class:)
  new(
    type_name: type_name,
    params: nil,
    super_class: super_class,
    self_types: nil,
    included_modules: nil,
    included_interfaces: nil,
    prepended_modules: nil,
    extended_modules: [],
    extended_interfaces: []
  )
end

Instance Attribute Details

#extended_interfaces (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 13

attr_reader :extended_interfaces

#extended_modules (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 12

attr_reader :extended_modules

#included_interfaces (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 10

attr_reader :included_interfaces

#included_modules (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 9

attr_reader :included_modules

#params (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 6

attr_reader :params

#prepended_modules (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 11

attr_reader :prepended_modules

#self_types (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 8

attr_reader :self_types

#super_class (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 7

attr_reader :super_class

#type_name (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 5

attr_reader :type_name

Instance Method Details

#each_ancestor(&block)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 27

def each_ancestor(&block)
  if block
    if s = super_class
      yield s
    end

    each_self_type(&block)
    each_included_module(&block)
    each_included_interface(&block)
    each_prepended_module(&block)
    each_extended_module(&block)
    each_extended_interface(&block)
  else
    enum_for :each_ancestor
  end
end

#each_extended_interface(&block)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 84

def each_extended_interface(&block)
  if block
    extended_interfaces&.each(&block)
  else
    enum_for :each_extended_interface
  end
end

#each_extended_module(&block)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 76

def each_extended_module(&block)
  if block
    extended_modules&.each(&block)
  else
    enum_for :each_extended_module
  end
end

#each_included_interface(&block)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 60

def each_included_interface(&block)
  if block
    included_interfaces&.each(&block)
  else
    enum_for :each_included_interface
  end
end

#each_included_module(&block)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 52

def each_included_module(&block)
  if block
    included_modules&.each(&block)
  else
    enum_for :each_included_module
  end
end

#each_prepended_module(&block)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 68

def each_prepended_module(&block)
  if block
    prepended_modules&.each(&block)
  else
    enum_for :each_prepended_module
  end
end

#each_self_type(&block)

[ GitHub ]

  
# File 'lib/rbs/definition_builder/ancestor_builder.rb', line 44

def each_self_type(&block)
  if block
    self_types&.each(&block)
  else
    enum_for :each_self_type
  end
end