Class: T::Private::DeclState

Inherits:
Object
  • Object
show all
Defined in:
lib/types/private/decl_state.rb

Overview

typed: true

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#active_declarationObject

Returns the value of attribute active_declaration.



13
14
15
# File 'lib/types/private/decl_state.rb', line 13

def active_declaration
  @active_declaration
end

#skip_on_method_addedObject

Returns the value of attribute skip_on_method_added.



14
15
16
# File 'lib/types/private/decl_state.rb', line 14

def skip_on_method_added
  @skip_on_method_added
end

Class Method Details

.currentObject



5
6
7
# File 'lib/types/private/decl_state.rb', line 5

def self.current
  Thread.current[:opus_types__decl_state] ||= self.new
end

.current=(other) ⇒ Object



9
10
11
# File 'lib/types/private/decl_state.rb', line 9

def self.current=(other)
  Thread.current[:opus_types__decl_state] = other
end

Instance Method Details

#reset!Object



16
17
18
# File 'lib/types/private/decl_state.rb', line 16

def reset!
  self.active_declaration = nil
end

#without_on_method_addedObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/types/private/decl_state.rb', line 20

def without_on_method_added
  begin
    # explicit 'self' is needed here
    old_value = self.skip_on_method_added
    self.skip_on_method_added = true
    yield
  ensure
    self.skip_on_method_added = old_value
  end
end