Module: NEAT::DSL

Defined in:
lib/rubyneat_dashboard/rubyneat_dsl.rb

Instance Method Summary collapse

Instance Method Details

#bind(bindaddr) ⇒ Object

FIXME: this is set too late in the game.



32
33
34
# File 'lib/rubyneat_dashboard/rubyneat_dsl.rb', line 32

def bind(bindaddr)
  Dashboard::opts.bindaddr = bindaddr
end

#dashboard(&block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rubyneat_dashboard/rubyneat_dsl.rb', line 23

def dashboard(&block)
  Dashboard::dq ||= DashboardQueues.new

  #FIXME: this is set too late in the game.
  def port(portnum)
    Dashboard::opts.port = portnum
  end

  #FIXME: this is set too late in the game.
  def bind(bindaddr)
    Dashboard::opts.bindaddr = bindaddr
  end

  block.() if block_given?
  Dashboard::run_dashboard!

  NEAT::controller.pre_exit_add do
    puts "Dashboard waiting for user to exit. Or you may do a ^C."
    Dashboard::join!
    puts "Dashboard exited."
  end

  NEAT::controller.end_run_add  do |c|
    puts 'Dashboard end_run called.'
  end

  NEAT::controller.report_add do |pop, rept|
    Dashboard.dq.population << Dashboard.report_on(pop, rept)
  end
end

#port(portnum) ⇒ Object

FIXME: this is set too late in the game.



27
28
29
# File 'lib/rubyneat_dashboard/rubyneat_dsl.rb', line 27

def port(portnum)
  Dashboard::opts.port = portnum
end