Module: Lotu::SystemUser::ClassMethods

Defined in:
lib/lotu/behaviors/system_user.rb

Overview

Allows to activate a system in the host

Instance Method Summary collapse

Instance Method Details

#use(klass, opts = {}) ⇒ Object

specify the systems you want to use, using module names



62
63
64
65
# File 'lib/lotu/behaviors/system_user.rb', line 62

def use( klass, opts={} )
  behavior_options[SystemUser] ||= Hash.new
  behavior_options[SystemUser][klass] = opts
end

#use_systems(*system_names) ⇒ Object

specify the systems you want to use, using symbols instead of module names



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/lotu/behaviors/system_user.rb', line 47

def use_systems *system_names
  system_names.each do |system_name|
    if system_name.is_a? Symbol
      use Lotu.const_get("#{system_name.to_s.capitalize}System")
    elsif system_name.is_a? Hash
      system_name.each do |key,value|
        use Lotu.const_get("#{key.capitalize}System"), value
      end
    else
      raise "Unsupported system name as #{system_name.class}"
    end
  end
end