Class: MemWatcher
- Inherits:
-
Object
- Object
- MemWatcher
- Defined in:
- lib/mem-watcher/mem-watcher.rb
Instance Attribute Summary collapse
-
#cpu ⇒ Object
Returns the value of attribute cpu.
-
#memory ⇒ Object
Returns the value of attribute memory.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cpu ⇒ Object
Returns the value of attribute cpu.
3 4 5 |
# File 'lib/mem-watcher/mem-watcher.rb', line 3 def cpu @cpu end |
#memory ⇒ Object
Returns the value of attribute memory.
2 3 4 |
# File 'lib/mem-watcher/mem-watcher.rb', line 2 def memory @memory end |
Class Method Details
.watch(args = {}) ⇒ Object
5 6 7 |
# File 'lib/mem-watcher/mem-watcher.rb', line 5 def self.watch(args={}) new.watch(args) end |
Instance Method Details
#watch(args = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mem-watcher/mem-watcher.rb', line 9 def watch(args={}) return false unless correct_env?(args) if is_device? NSLog("Sorry, you can not run mem-watcher on a device.") false else parent_view = args[:parent_view] if args[:parent_view] parent_view ||= UIApplication.sharedApplication.delegate.window if UIApplication.sharedApplication.delegate.respond_to?(:window) parent_view || abort("MemWatcher needs a `parent_view:` view or access to the window in your AppDelegate via a `window` accessor.") parent_view.addSubview label print "Starting MemWatcher..." start_watcher puts "done." true end end |