Module: Dev::UI::StdoutRouter
- Defined in:
- lib/dev/ui/stdout_router.rb
Defined Under Namespace
Constant Summary collapse
- WRITE_WITHOUT_DEV_UI =
- :write_without_dev_ui
- NotEnabled =
- Class.new(StandardError) 
Class Attribute Summary collapse
- 
  
    
      .duplicate_output_to  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute duplicate_output_to. 
Class Method Summary collapse
- .assert_enabled! ⇒ Object
- .disable ⇒ Object
- .enable ⇒ Object
- .enabled?(stream = $stdout) ⇒ Boolean
- 
  
    
      .ensure_activated  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    TODO: remove this. 
- .with_enabled ⇒ Object
Class Attribute Details
.duplicate_output_to ⇒ Object
Returns the value of attribute duplicate_output_to.
| 8 9 10 | # File 'lib/dev/ui/stdout_router.rb', line 8 def duplicate_output_to @duplicate_output_to end | 
Class Method Details
.assert_enabled! ⇒ Object
| 134 135 136 | # File 'lib/dev/ui/stdout_router.rb', line 134 def assert_enabled! raise NotEnabled unless enabled? end | 
.disable ⇒ Object
| 161 162 163 164 165 166 | # File 'lib/dev/ui/stdout_router.rb', line 161 def disable return false unless enabled?($stdout) && enabled?($stderr) deactivate($stdout) deactivate($stderr) true end | 
.enable ⇒ Object
| 150 151 152 153 154 155 | # File 'lib/dev/ui/stdout_router.rb', line 150 def enable return false if enabled?($stdout) || enabled?($stderr) activate($stdout, :stdout) activate($stderr, :stderr) true end | 
.enabled?(stream = $stdout) ⇒ Boolean
| 157 158 159 | # File 'lib/dev/ui/stdout_router.rb', line 157 def enabled?(stream = $stdout) stream.respond_to?(WRITE_WITHOUT_DEV_UI) end | 
.ensure_activated ⇒ Object
TODO: remove this
| 146 147 148 | # File 'lib/dev/ui/stdout_router.rb', line 146 def ensure_activated enable unless enabled? end | 
.with_enabled ⇒ Object
| 138 139 140 141 142 143 | # File 'lib/dev/ui/stdout_router.rb', line 138 def with_enabled enable yield ensure disable end |