Class: Inspec::Resources::NginxConfServer
- Inherits:
- 
      Object
      
        - Object
- Inspec::Resources::NginxConfServer
 
- Defined in:
- lib/resources/nginx_conf.rb
Instance Attribute Summary collapse
- 
  
    
      #params  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute params. 
- 
  
    
      #parent  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute parent. 
Instance Method Summary collapse
- 
  
    
      #initialize(params, parent)  ⇒ NginxConfServer 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of NginxConfServer. 
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(params, parent) ⇒ NginxConfServer
Returns a new instance of NginxConfServer.
| 180 181 182 183 | # File 'lib/resources/nginx_conf.rb', line 180 def initialize(params, parent) @parent = parent @params = params || {} end | 
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
| 179 180 181 | # File 'lib/resources/nginx_conf.rb', line 179 def params @params end | 
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
| 179 180 181 | # File 'lib/resources/nginx_conf.rb', line 179 def parent @parent end | 
Instance Method Details
#to_s ⇒ Object Also known as: inspect
| 189 190 191 192 193 194 195 196 197 198 199 200 | # File 'lib/resources/nginx_conf.rb', line 189 def to_s server = '' name = Array(params['server_name']).flatten.first unless name.nil? server += name listen = Array(params['listen']).flatten.first server += ":#{listen}" unless listen.nil? end # go two levels up: 1. to the http entry and 2. to the root nginx conf @parent.parent.to_s + ", server #{server}" end |