Module: Lotu::SystemUser

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

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#systemsObject

Returns the value of attribute systems.



4
5
6
# File 'lib/lotu/behaviors/system_user.rb', line 4

def systems
  @systems
end

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/lotu/behaviors/system_user.rb', line 6

def self.included base
  base.extend ClassMethods
end

Instance Method Details

#drawObject

Need to call this inside draw



33
34
35
36
37
38
39
# File 'lib/lotu/behaviors/system_user.rb', line 33

def draw
  super if defined? super
  # Systems may report interesting stuff
  @systems.each_value do |system|
    system.draw
  end
end

#init_behavior(user_opts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lotu/behaviors/system_user.rb', line 10

def init_behavior user_opts
  super if defined? super
  @systems ||= Hash.new

  options_for_me = self.class.behavior_options[SystemUser]

  options_for_me && options_for_me.each do |klass, options|
    # add the behavior options to the user_opts hash
    # in case we need access to some level class config param
    user_opts.merge!(options)
    @systems[klass] = klass.new( self, user_opts )
  end
end

#updateObject

Need to call this inside update



25
26
27
28
29
30
# File 'lib/lotu/behaviors/system_user.rb', line 25

def update
  super if defined? super
  @systems.each_value do |system|
    system.update
  end
end