Class: Server
- Inherits:
-
Object
- Object
- Server
- Defined in:
- lib/gl_tail/server.rb
Overview
gl_tail.rb - OpenGL visualization of your server traffic Copyright 2007 Erlend Simonsen <[email protected]>
Licensed under the GNU General Public License v2 (see LICENSE)
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
-
#add_activity(options = { }) ⇒ Object
block, message, size.
-
#add_event(options = { }) ⇒ Object
block, message.
-
#initialize(options) ⇒ Server
constructor
A new instance of Server.
- #update ⇒ Object
Constructor Details
#initialize(options) ⇒ Server
Returns a new instance of Server.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gl_tail/server.rb', line 11 def initialize() @name = [:name] || [:host] @host = [:host] @color = [:color] || [1.0, 1.0, 1.0, 1.0] @parser = Parser.registry[ [:parser] ] || Parser.registry[ :apache ] @blocks = [:blocks] @max_size = 1.0 # instantiate the parser @parser = @parser.new( self ) end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
8 9 10 |
# File 'lib/gl_tail/server.rb', line 8 def color @color end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
8 9 10 |
# File 'lib/gl_tail/server.rb', line 8 def host @host end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/gl_tail/server.rb', line 8 def name @name end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
8 9 10 |
# File 'lib/gl_tail/server.rb', line 8 def parser @parser end |
Instance Method Details
#add_activity(options = { }) ⇒ Object
block, message, size
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gl_tail/server.rb', line 25 def add_activity( = { }) size = $CONFIG.min_blob_size if [:size] size = [:size].to_f @max_size = size if size > @max_size size = $CONFIG.min_blob_size + ((size / @max_size) * ($CONFIG.max_blob_size - $CONFIG.min_blob_size)) [:size] = size end block = @blocks[[:block]].add_activity( { :name => @name, :color => @color, :size => $CONFIG.min_blob_size }.update() ) if ([:block] && @blocks[[:block]]) end |
#add_event(options = { }) ⇒ Object
block, message
38 39 40 |
# File 'lib/gl_tail/server.rb', line 38 def add_event( = { }) block = @blocks[[:block]].add_event( { :name => @name, :color => @color, :size => $CONFIG.min_blob_size}.update() ) if ([:block] && @blocks[[:block]]) end |
#update ⇒ Object
42 43 44 |
# File 'lib/gl_tail/server.rb', line 42 def update @max_size = @max_size * 0.99 if(@max_size * 0.99 > 1.0) end |