Sha256: c4984ddb07378f6072762e5fdf3723d474e14f4cb552a3720d55303f2a5791a3

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 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
    
    #---
  
    define_method :groups do
      array(myself[:settings])
    end     
  end
end
end
end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
corl-0.4.15 lib/core/mixin/macro/network_settings.rb
corl-0.4.14 lib/core/mixin/macro/network_settings.rb
corl-0.4.13 lib/core/mixin/macro/network_settings.rb
corl-0.4.12 lib/core/mixin/macro/network_settings.rb
corl-0.4.11 lib/core/mixin/macro/network_settings.rb