Class: Inspec::Resources::NginxConfServer
- Inherits:
 - 
      Object
      
        
- Object
 - Inspec::Resources::NginxConfServer
 
 
- Defined in:
 - lib/inspec/resources/nginx_conf.rb
 
Overview
TODO: rename NginxServer
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.
 - #method_missing(name) ⇒ Object
 - #respond_to_missing?(name, include_all = false) ⇒ Boolean
 - #to_s ⇒ Object (also: #inspect)
 
Constructor Details
#initialize(params, parent) ⇒ NginxConfServer
Returns a new instance of NginxConfServer.
      214 215 216 217  | 
    
      # File 'lib/inspec/resources/nginx_conf.rb', line 214 def initialize(params, parent) @parent = parent @params = params || {} end  | 
  
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
      237 238 239 240 241  | 
    
      # File 'lib/inspec/resources/nginx_conf.rb', line 237 def method_missing(name) return super if name.to_s.match?(/^to_/) (@params[name.to_s] || []).flatten end  | 
  
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
      213 214 215  | 
    
      # File 'lib/inspec/resources/nginx_conf.rb', line 213 def params @params end  | 
  
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
      213 214 215  | 
    
      # File 'lib/inspec/resources/nginx_conf.rb', line 213 def parent @parent end  | 
  
Instance Method Details
#respond_to_missing?(name, include_all = false) ⇒ Boolean
      243 244 245 246 247  | 
    
      # File 'lib/inspec/resources/nginx_conf.rb', line 243 def respond_to_missing?(name, include_all = false) return super if name.to_s.match?(/^to_/) true end  | 
  
#to_s ⇒ Object Also known as: inspect
      223 224 225 226 227 228 229 230 231 232 233 234  | 
    
      # File 'lib/inspec/resources/nginx_conf.rb', line 223 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  |