Module: StateInspector::Snoop::ClassMethods
- Defined in:
- lib/state_inspector/snoop.rb
Instance Method Summary collapse
- #informant? ⇒ Boolean
- #state_inspector ⇒ Object
- #tell_si(*args, &block) ⇒ Object
- #toggle_informant ⇒ Object
Instance Method Details
#informant? ⇒ Boolean
32 33 34 |
# File 'lib/state_inspector/snoop.rb', line 32 def informant? @informant || self.class.instance_variable_get(:@informant) end |
#state_inspector ⇒ Object
11 12 13 |
# File 'lib/state_inspector/snoop.rb', line 11 def state_inspector StateInspector.new(self) end |
#tell_si(*args, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/state_inspector/snoop.rb', line 15 def tell_si *args, &block if informant? key = self.respond_to?(:class_exec) ? self : self.class key = Reporter.has_key?(key) ? key : self Reporter[key].update(self, *args, &block) end end |
#toggle_informant ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/state_inspector/snoop.rb', line 23 def toggle_informant state_inspector.snoop_setters( *(self.respond_to?(:class_exec) ? self : self.class). instance_methods.grep(/=\z/) - Object.methods ) unless @state_inspector || self.class.instance_variable_get(:@state_inspector) @informant = !@informant end |