Sha256: 18e93c8b779ffcdc18aa1f4d328c924df5d4f28902830c1090e93b8bfc79f2cd

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

module CORL
module Mixin
module Macro
module NetworkSettings
  
  def network_settings(_type)
    
    # Networks are inherited unless explicitely set
     
    define_method :network do
      plugin_parent
    end
 
    define_method :network= do |network|
      myself.plugin_parent = network
    end
  
    #---
  
    define_method :setting do |property, default = nil, format = false|
      network.send("#{_type}_setting", plugin_provider, plugin_name, property, default, format)
    end
  
    define_method :search do |property, default = nil, format = false|
      network.send("search_#{_type}", plugin_provider, plugin_name, property, default, format)
    end
  
    define_method :set_setting do |property, value = nil|
      network.send("set_#{_type}_setting", plugin_provider, plugin_name, property, value)
    end
  
    define_method :delete_setting do |property|
      network.send("delete_#{_type}_setting", plugin_provider, plugin_name, property)
    end
  
    #---
 
    define_method :[] do |name, default = nil, format = false|
      search(name, default, format)
    end
  
    #---
  
    define_method :[]= do |name, value|
      set_setting(name, value)
    end   
  end
end
end
end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
corl-0.4.10 lib/core/mixin/macro/network_settings.rb
corl-0.4.9 lib/core/mixin/macro/network_settings.rb
corl-0.4.8 lib/core/mixin/macro/network_settings.rb
corl-0.4.7 lib/core/mixin/macro/network_settings.rb
corl-0.4.6 lib/core/mixin/macro/network_settings.rb
corl-0.4.5 lib/core/mixin/macro/network_settings.rb
corl-0.4.4 lib/core/mixin/macro/network_settings.rb
corl-0.4.3 lib/core/mixin/macro/network_settings.rb