Class: Kudzu::Adapter::Memory::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/kudzu/adapter/memory/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRepository

Returns a new instance of Repository.


7
8
9
# File 'lib/kudzu/adapter/memory/repository.rb', line 7

def initialize
  @page = {}
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page


5
6
7
# File 'lib/kudzu/adapter/memory/repository.rb', line 5

def page
  @page
end

Instance Method Details

#delete(page) ⇒ Object


19
20
21
# File 'lib/kudzu/adapter/memory/repository.rb', line 19

def delete(page)
  @page.delete(page.url)
end

#find_by_url(url) ⇒ Object


11
12
13
# File 'lib/kudzu/adapter/memory/repository.rb', line 11

def find_by_url(url)
  @page[url] || Page.new(url: url)
end

#register(page) ⇒ Object


15
16
17
# File 'lib/kudzu/adapter/memory/repository.rb', line 15

def register(page)
  @page[page.url] = page
end