Class: Stumb::Stamp

Inherits:
Object
  • Object
show all
Defined in:
lib/stumb/stamp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(req) ⇒ Stamp

Returns a new instance of Stamp.



4
5
6
7
# File 'lib/stumb/stamp.rb', line 4

def initialize(req)
  @time = Time.now
  @request  = req
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



3
4
5
# File 'lib/stumb/stamp.rb', line 3

def request
  @request
end

#timeObject (readonly)

Returns the value of attribute time.



3
4
5
# File 'lib/stumb/stamp.rb', line 3

def time
  @time
end

Instance Method Details

#bodyObject



9
10
11
12
13
14
15
16
# File 'lib/stumb/stamp.rb', line 9

def body
  return @body if @body
  begin
    @body ||= @request.body.read
  ensure
    @request.body.rewind
  end
end