Class: MetOnTheMiddle::Request
- Inherits:
-
Object
- Object
- MetOnTheMiddle::Request
- 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
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
- #add(key, value) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(time = Time.new) ⇒ Request
constructor
A new instance of Request.
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/met_on_the_middle/request.rb', line 8 def data @data end |
#time ⇒ Object
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 |