Class: Proxy::Dns::Dnsmasq::Openwrt::DSL::Config
- Inherits:
-
Object
- Object
- Proxy::Dns::Dnsmasq::Openwrt::DSL::Config
- Defined in:
- lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, name = nil) ⇒ Config
constructor
A new instance of Config.
- #to_s ⇒ Object
Constructor Details
#initialize(type, name = nil) ⇒ Config
Returns a new instance of Config.
94 95 96 97 98 |
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 94 def initialize(type, name = nil) @type = type.to_sym @name = name @options = {} end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
92 93 94 |
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 92 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
92 93 94 |
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 92 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
92 93 94 |
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 92 def type @type end |
Instance Method Details
#to_s ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/smart_proxy_dns_dnsmasq/backend/openwrt.rb', line 100 def to_s "config #{type} #{name}\n" + .map do |name, value| if value.is_a? Array value.map do|val| " list #{name} '#{val}'" end.join "\n" else " option #{name} '#{value}'" end end.join("\n") + "\n" end |