{"action":"opened","issue":{"url":"https://api.github.com/repos/roo-rb/roo/issues/428","repository_url":"https://api.github.com/repos/roo-rb/roo","labels_url":"https://api.github.com/repos/roo-rb/roo/issues/428/labels{/name}","comments_url":"https://api.github.com/repos/roo-rb/roo/issues/428/comments","events_url":"https://api.github.com/repos/roo-rb/roo/issues/428/events","html_url":"https://github.com/roo-rb/roo/issues/428","id":324884026,"number":428,"title":"each() should skip the header row?","user":{"login":"paneq","id":65587,"avatar_url":"https://avatars2.githubusercontent.com/u/65587?v=4","gravatar_id":"","url":"https://api.github.com/users/paneq","html_url":"https://github.com/paneq","followers_url":"https://api.github.com/users/paneq/followers","following_url":"https://api.github.com/users/paneq/following{/other_user}","gists_url":"https://api.github.com/users/paneq/gists{/gist_id}","starred_url":"https://api.github.com/users/paneq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paneq/subscriptions","organizations_url":"https://api.github.com/users/paneq/orgs","repos_url":"https://api.github.com/users/paneq/repos","events_url":"https://api.github.com/users/paneq/events{/privacy}","received_events_url":"https://api.github.com/users/paneq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-21T11:34:12Z","updated_at":"2018-05-21T11:34:12Z","closed_at":null,"author_association":"NONE","body":"`Roo::Base#each()` method does not skip the row detected as header.\r\n\r\nhttps://gist.github.com/paneq/4e866bf8be2e2c3c35bc396944f5b630\r\n\r\nNo matter what I try I get:\r\n\r\n```\r\n{:name=>\"name\", :isbn=>\"isbn\", :quantity=>\"quantity\"}\r\n{:name=>\"Old Book\", :isbn=>9781609731939, :quantity=>10}\r\n{:name=>\"Recent Book\", :isbn=>9781609737207, :quantity=>1}\r\n{:name=>\"New Book\", :isbn=>9781609731946, :quantity=>2}\r\n{:name=>\"Ignore Because Quantity Blank\", :isbn=>\"978XYZ\", :quantity=>nil}\r\n```\r\n\r\nand I would prefer:\r\n\r\n```\r\n{:name=>\"Old Book\", :isbn=>9781609731939, :quantity=>10}\r\n{:name=>\"Recent Book\", :isbn=>9781609737207, :quantity=>1}\r\n{:name=>\"New Book\", :isbn=>9781609731946, :quantity=>2}\r\n{:name=>\"Ignore Because Quantity Blank\", :isbn=>\"978XYZ\", :quantity=>nil}\r\n```\r\n\r\nI tried:\r\n\r\n* `each(headers: :first_row)`\r\n* `each(name: 'name',isbn: 'isbn',quantity: 'quantity')`\r\n* `each(header_search: %w(name isbn quantity))`\r\n\r\nIt appears to me that:\r\n\r\n```\r\n  def each(options = {})\r\n    return to_enum(:each, options) unless block_given?\r\n\r\n    if options.empty?\r\n      1.upto(last_row) do |line|\r\n        yield row(line)\r\n      end\r\n    else\r\n      clean_sheet_if_need(options)\r\n      search_or_set_header(options)\r\n      headers = @headers ||\r\n                Hash[(first_column..last_column).map do |col|\r\n                  [cell(@header_line, col), col]\r\n                end]\r\n\r\n      @header_line.upto(last_row) do |line|\r\n        yield(Hash[headers.map { |k, v| [k, cell(line, v)] }])\r\n      end\r\n    end\r\n  end\r\n```\r\n\r\nI expected it to be `(@header_line+1).upto(last_row)`."}}
{"actor":{"display_login":"paneq"}}