Class: Deltacloud::Exceptions::ExceptionDef
- Inherits:
 - 
      Object
      
        
- Object
 - Deltacloud::Exceptions::ExceptionDef
 
 
- Defined in:
 - lib/deltacloud/drivers/exceptions.rb
 
Instance Attribute Summary collapse
- 
  
    
      #conditions  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute conditions.
 - 
  
    
      #handler(e)  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute handler.
 - 
  
    
      #message(message)  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute message.
 - 
  
    
      #status(code)  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute status.
 
Instance Method Summary collapse
- 
  
    
      #any?(e)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Condition can be class or regexp.
 - #exception(handler) ⇒ Object
 - 
  
    
      #initialize(conditions, &block)  ⇒ ExceptionDef 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ExceptionDef.
 
Constructor Details
#initialize(conditions, &block) ⇒ ExceptionDef
Returns a new instance of ExceptionDef.
      129 130 131 132 133  | 
    
      # File 'lib/deltacloud/drivers/exceptions.rb', line 129 def initialize(conditions, &block) @conditions = conditions instance_eval(&block) if block_given? self end  | 
  
Instance Attribute Details
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
      126 127 128  | 
    
      # File 'lib/deltacloud/drivers/exceptions.rb', line 126 def conditions @conditions end  | 
  
#handler(e) ⇒ Object (readonly)
Returns the value of attribute handler.
      127 128 129  | 
    
      # File 'lib/deltacloud/drivers/exceptions.rb', line 127 def handler @handler end  | 
  
#message(message) ⇒ Object
Returns the value of attribute message.
      125 126 127  | 
    
      # File 'lib/deltacloud/drivers/exceptions.rb', line 125 def @message end  | 
  
#status(code) ⇒ Object
Returns the value of attribute status.
      124 125 126  | 
    
      # File 'lib/deltacloud/drivers/exceptions.rb', line 124 def status @status end  | 
  
Instance Method Details
#any?(e) ⇒ Boolean
Condition can be class or regexp
      149 150 151 152 153 154 155  | 
    
      # File 'lib/deltacloud/drivers/exceptions.rb', line 149 def any?(e) @conditions.each do |c| return true if c.class == Class && e.class == c return true if c.class == Regexp && (e.class.name =~ c or e. =~ c) end return false end  | 
  
#exception(handler) ⇒ Object
      143 144 145  | 
    
      # File 'lib/deltacloud/drivers/exceptions.rb', line 143 def exception(handler) self.handler = handler end  |