Class: MemDB::Entries

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

Defined Under Namespace

Classes: Entry

Instance Method Summary collapse

Constructor Details

#initializeEntries

Returns a new instance of Entries.



20
21
22
# File 'lib/mem_db.rb', line 20

def initialize
  @entries = []
end

Instance Method Details

#[](id) ⇒ Object



24
25
26
# File 'lib/mem_db.rb', line 24

def [](id)
  @entries[id]
end

#add(matching, value) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/mem_db.rb', line 28

def add(matching, value)
  id = @entries.length

  entry = Entry.new(id, matching, value)
  @entries.push(entry)

  id
end