Class: T::Private::DeclState
- Inherits:
-
Object
- Object
- T::Private::DeclState
- Defined in:
- lib/types/private/decl_state.rb
Overview
typed: true
Instance Attribute Summary collapse
-
#active_declaration ⇒ Object
Returns the value of attribute active_declaration.
-
#previous_declaration ⇒ Object
Returns the value of attribute previous_declaration.
-
#skip_on_method_added ⇒ Object
Returns the value of attribute skip_on_method_added.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#active_declaration ⇒ Object
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 |
#previous_declaration ⇒ Object
Returns the value of attribute previous_declaration.
15 16 17 |
# File 'lib/types/private/decl_state.rb', line 15 def previous_declaration @previous_declaration end |
#skip_on_method_added ⇒ Object
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
.current ⇒ Object
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
#consume! ⇒ Object
22 23 24 25 26 |
# File 'lib/types/private/decl_state.rb', line 22 def consume! @previous_declaration = self.active_declaration self.active_declaration = nil @previous_declaration end |
#reset! ⇒ Object
17 18 19 20 |
# File 'lib/types/private/decl_state.rb', line 17 def reset! self.active_declaration = nil @previous_declaration = nil end |
#without_on_method_added ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/types/private/decl_state.rb', line 28 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 |