lib/bill_hicks/inventory.rb in bill_hicks-1.1.7 vs lib/bill_hicks/inventory.rb in bill_hicks-1.1.8

- old
+ new

@@ -18,15 +18,13 @@ def self.all(options = {}) requires!(options, :username, :password) new(options).all end - def self.process_as_chunks(size = 15, options = {}) + def self.process_as_chunks(size = 15, options = {}, &block) requires!(options, :username, :password) - new(options).process_as_chunks(size) do |chunk| - yield(chunk) - end + new(options).process_as_chunks(size, &block) end # Returns an array of hashes with the inventory item details. def all inventory = [] @@ -49,10 +47,10 @@ end # Streams csv and chunks it # # @size integer The number of items in each chunk - def process_as_chunks(size) + def process_as_chunks(size, &block) connect(@options) do |ftp| temp_csv_file = Tempfile.new ftp.chdir(BillHicks.config.top_level_dir) ftp.getbinaryfile(INVENTORY_FILENAME, temp_csv_file.path)