Class: Proxy::Dns::Dnsmasq::Openwrt::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb

Defined Under Namespace

Classes: Config

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ DSL

Returns a new instance of DSL.



113
114
115
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 113

def initialize(config)
  @configs = config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



117
118
119
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 117

def method_missing(m, *args)
  [m, args].flatten
end

Instance Method Details

#config(args) ⇒ Object



121
122
123
124
125
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 121

def config(args)
  type, name = args
  @current_config = Config.new type, name
  @configs << @current_config 
end

#list(args) ⇒ Object



133
134
135
136
137
138
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 133

def list(args)
  name, value = args

  @current_config.options[name] = [] unless @current_config.options[name]
  @current_config.options[name] << value
end

#option(args) ⇒ Object



127
128
129
130
131
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 127

def option(args)
  name, value = args

  @current_config.options[name] = value
end