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



4
5
6
# File 'lib/rbs/prototype/rb.rb', line 4

def module_function
  @module_function
end

#namespaceObject

Returns the value of attribute namespace

Returns:

  • (Object)

    the current value of namespace



4
5
6
# File 'lib/rbs/prototype/rb.rb', line 4

def namespace
  @namespace
end

#singletonObject

Returns the value of attribute singleton

Returns:

  • (Object)

    the current value of singleton



4
5
6
# File 'lib/rbs/prototype/rb.rb', line 4

def singleton
  @singleton
end

Class Method Details

.initial(namespace: Namespace.root) ⇒ Object



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

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

Instance Method Details

#attribute_kindObject



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

def attribute_kind
  if singleton
    :singleton
  else
    :instance
  end
end

#method_kindObject



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

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