Class: Zillace::Place
- Inherits:
-
Object
- Object
- Zillace::Place
- Defined in:
- lib/zillace.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
- .each(database: Database.new.connect, &block) ⇒ Object
- .find(id, database: Database.new.connect) ⇒ Object
Instance Method Summary collapse
-
#initialize(id:, url:, title:) ⇒ Place
constructor
A new instance of Place.
Constructor Details
#initialize(id:, url:, title:) ⇒ Place
Returns a new instance of Place.
46 47 48 49 50 |
# File 'lib/zillace.rb', line 46 def initialize(id:, url:, title:) @id = id @url = url @title = title end |
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
44 45 46 |
# File 'lib/zillace.rb', line 44 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
44 45 46 |
# File 'lib/zillace.rb', line 44 def url @url end |
Class Method Details
.each(database: Database.new.connect, &block) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/zillace.rb', line 52 def self.each(database: Database.new.connect, &block) enumerator = Enumerator.new do |enumerator| database.execute('select id, url, title from moz_places') do |row| id, url, title = row enumerator << new(id:, url:, title:) end end block_given? ? enumerator.each(&block) : enumerator end |