Class: GG::Logger

Inherits:
Object show all
Extended by:
Forwardable
Defined in:
lib/gg/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Logger

Returns a new instance of Logger.



7
8
9
10
11
12
13
# File 'lib/gg/logger.rb', line 7

def initialize( env )
  @env = env
  @time = Time.now
  @html_array = []
  @console_array = []
  @is_empty = true
end

Instance Attribute Details

#console_arrayObject (readonly)

Returns the value of attribute console_array.



15
16
17
# File 'lib/gg/logger.rb', line 15

def console_array
  @console_array
end

#envObject (readonly)

Returns the value of attribute env.



15
16
17
# File 'lib/gg/logger.rb', line 15

def env
  @env
end

#html_arrayObject (readonly)

Returns the value of attribute html_array.



15
16
17
# File 'lib/gg/logger.rb', line 15

def html_array
  @html_array
end

#responseObject

Returns the value of attribute response.



16
17
18
# File 'lib/gg/logger.rb', line 16

def response
  @response
end

#timeObject (readonly)

Returns the value of attribute time.



15
16
17
# File 'lib/gg/logger.rb', line 15

def time
  @time
end

Instance Method Details

#<<(html) ⇒ Object

Adds the given HTML to the HTML array storing all logging information



27
28
29
30
# File 'lib/gg/logger.rb', line 27

def <<( html )
  @is_empty = false
  html_array << html
end

#empty?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/gg/logger.rb', line 37

def empty?
  @is_empty
end

#htmlObject

Returns a String that represent all the HTML sent to the logger via #<<



33
34
35
# File 'lib/gg/logger.rb', line 33

def html
  html_array.join
end

#requestObject



18
19
20
# File 'lib/gg/logger.rb', line 18

def request
  Rack::Request.new( env )
end