Class: MetOnTheMiddle::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/met_on_the_middle/request.rb

Overview

Classe che si occupa di raggruppare le informazioni per richiesta, se la chiave è già presente, il valore viene sommato

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time = Time.new) ⇒ Request

Returns a new instance of Request.



10
11
12
13
# File 'lib/met_on_the_middle/request.rb', line 10

def initialize(time=Time.new)
  @time = time
  @data = {}
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/met_on_the_middle/request.rb', line 8

def data
  @data
end

#timeObject

Returns the value of attribute time.



7
8
9
# File 'lib/met_on_the_middle/request.rb', line 7

def time
  @time
end

Instance Method Details

#add(key, value) ⇒ Object



15
16
17
# File 'lib/met_on_the_middle/request.rb', line 15

def add(key, value)
  @data[key]=value
end

#get(key) ⇒ Object



19
20
21
# File 'lib/met_on_the_middle/request.rb', line 19

def get(key)
  @data[key]
end