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



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

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

PONDER: Cambiar por initialize? y controlar el punto de llamado con super?



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

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



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

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