Class: LogGenerator::Apache::Host
- Inherits:
-
Object
- Object
- LogGenerator::Apache::Host
- Includes:
- RAND
- Defined in:
- lib/apache-loggen/base.rb
Constant Summary
Constants included from RAND
Instance Attribute Summary collapse
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
Instance Method Summary collapse
- #agent ⇒ Object
-
#initialize ⇒ Host
constructor
A new instance of Host.
Methods included from RAND
Constructor Details
#initialize ⇒ Host
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
#ip ⇒ Object (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
#agent ⇒ Object
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 |