Class: RBS::Prototype::RB::Context

Inherits:
Struct
  • Object
show all
Defined in:
lib/rbs/prototype/rb.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#module_functionObject

Returns the value of attribute module_function

Returns:

  • (Object)

    the current value of module_function



6
7
8
# File 'lib/rbs/prototype/rb.rb', line 6

def module_function
  @module_function
end

#namespaceObject

Returns the value of attribute namespace

Returns:

  • (Object)

    the current value of namespace



6
7
8
# File 'lib/rbs/prototype/rb.rb', line 6

def namespace
  @namespace
end

#singletonObject

Returns the value of attribute singleton

Returns:

  • (Object)

    the current value of singleton



6
7
8
# File 'lib/rbs/prototype/rb.rb', line 6

def singleton
  @singleton
end

Class Method Details

.initial(namespace: Namespace.root) ⇒ Object



7
8
9
# File 'lib/rbs/prototype/rb.rb', line 7

def self.initial(namespace: Namespace.root)
  self.new(module_function: false, singleton: false, namespace: namespace)
end

Instance Method Details

#attribute_kindObject



21
22
23
24
25
26
27
# File 'lib/rbs/prototype/rb.rb', line 21

def attribute_kind
  if singleton
    :singleton
  else
    :instance
  end
end

#method_kindObject



11
12
13
14
15
16
17
18
19
# File 'lib/rbs/prototype/rb.rb', line 11

def method_kind
  if singleton
    :singleton
  elsif module_function
    :singleton_instance
  else
    :instance
  end
end