Class: Factbase::Impatient::Query
- Inherits:
-
Object
- Object
- Factbase::Impatient::Query
- Defined in:
- lib/factbase/impatient.rb
Overview
Query decorator.
This is an internal class, it is not supposed to be instantiated directly.
Instance Method Summary collapse
- #delete!(fb = @fb) ⇒ Object
- #each(fb = @fb, params = {}) ⇒ Object
-
#initialize(term, maps, timeout, fb) ⇒ Query
constructor
A new instance of Query.
- #one(fb = @fb, params = {}) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(term, maps, timeout, fb) ⇒ Query
Returns a new instance of Query.
47 48 49 50 51 52 |
# File 'lib/factbase/impatient.rb', line 47 def initialize(term, maps, timeout, fb) @term = term @maps = maps @timeout = timeout @fb = fb end |
Instance Method Details
#delete!(fb = @fb) ⇒ Object
76 77 78 79 80 |
# File 'lib/factbase/impatient.rb', line 76 def delete!(fb = @fb) impatient('delete!') do @fb.query(@term, @maps).delete!(fb) end end |
#each(fb = @fb, params = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/factbase/impatient.rb', line 58 def each(fb = @fb, params = {}, &) return to_enum(__method__, fb, params) unless block_given? n = 0 impatient('each') do @fb.query(@term, @maps).each(fb, params) do |f| yield(f) n += 1 end end n end |
#one(fb = @fb, params = {}) ⇒ Object
70 71 72 73 74 |
# File 'lib/factbase/impatient.rb', line 70 def one(fb = @fb, params = {}) impatient('one') do @fb.query(@term, @maps).one(fb, params) end end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/factbase/impatient.rb', line 54 def to_s @term.to_s end |