Class: AgentX::History
- Inherits:
-
Object
- Object
- AgentX::History
- Includes:
- Enumerable
- Defined in:
- lib/agentx/history.rb
Defined Under Namespace
Classes: Entry
Instance Method Summary collapse
- #[](n) ⇒ Object
- #add(request, response) ⇒ Object
- #each(&block) ⇒ Object
- #first ⇒ Object
-
#initialize ⇒ History
constructor
A new instance of History.
- #last ⇒ Object
- #length ⇒ Object
Constructor Details
#initialize ⇒ History
Returns a new instance of History.
7 8 9 |
# File 'lib/agentx/history.rb', line 7 def initialize @entries = [] end |
Instance Method Details
#[](n) ⇒ Object
15 16 17 |
# File 'lib/agentx/history.rb', line 15 def [](n) @entries[n] end |
#add(request, response) ⇒ Object
11 12 13 |
# File 'lib/agentx/history.rb', line 11 def add(request, response) @entries << Entry.new(request, response) end |
#each(&block) ⇒ Object
31 32 33 |
# File 'lib/agentx/history.rb', line 31 def each(&block) @entries.each(&block) end |
#first ⇒ Object
19 20 21 |
# File 'lib/agentx/history.rb', line 19 def first @entries.first end |
#last ⇒ Object
23 24 25 |
# File 'lib/agentx/history.rb', line 23 def last @entries.last end |
#length ⇒ Object
27 28 29 |
# File 'lib/agentx/history.rb', line 27 def length @entries.length end |