lib/redlander/model_proxy.rb in redlander-0.2.1 vs lib/redlander/model_proxy.rb in redlander-0.2.2

- old
+ new

@@ -55,30 +55,34 @@ # Find statements satisfying the given criteria. # Scope can be: # :all # :first - def find(scope, options = {}) + def find(scope, options = {}, &block) statement = Statement.new(options) rdf_stream = Redland.librdf_model_find_statements(@model.rdf_model, statement.rdf_statement) proxy = self.class.new(@model, rdf_stream) case scope when :first proxy.first when :all if block_given? - proxy.each + proxy.each(&block) else proxy end else raise RedlandError.new("Invalid search scope '#{scope}' specified.") end end def all(options = {}) - find(:all, options) + [].tap do |st| + find(:all, options) do |fs| + st << fs + end + end end end end