Class: LogGenerator::Apache::Host

Inherits:
Object
  • Object
show all
Includes:
RAND
Defined in:
lib/apache-loggen/base.rb

Constant Summary

Constants included from RAND

RAND::RANDOM

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RAND

#grand

Constructor Details

#initializeHost

Returns a new instance of Host.



152
153
154
155
# File 'lib/apache-loggen/base.rb', line 152

def initialize
  @ip = "#{(grand(210)+20)/4*4}.#{(grand(210)+20)/3*3}.#{grand(210)+20}.#{grand(210)+20}"
  @agents = []
end

Instance Attribute Details

#ipObject (readonly)

Returns the value of attribute ip.



157
158
159
# File 'lib/apache-loggen/base.rb', line 157

def ip
  @ip
end

Instance Method Details

#agentObject



159
160
161
162
163
164
165
166
167
# File 'lib/apache-loggen/base.rb', line 159

def agent
  if @agents.size == 4
    @agents[grand(4)]
  else
    agent = AGENT_LIST[grand(AGENT_LIST.size)]
    @agents << agent
    agent
  end
end