{"action":"created","issue":{"url":"https://api.github.com/repos/paul/progress_bar/issues/31","labels_url":"https://api.github.com/repos/paul/progress_bar/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/paul/progress_bar/issues/31/comments","events_url":"https://api.github.com/repos/paul/progress_bar/issues/31/events","html_url":"https://github.com/paul/progress_bar/pull/31","id":103504456,"number":31,"title":"bar width differs while bar.increment!","user":{"login":"delta4d","id":2194462,"avatar_url":"https://avatars.githubusercontent.com/u/2194462?v=3","gravatar_id":"","url":"https://api.github.com/users/delta4d","html_url":"https://github.com/delta4d","followers_url":"https://api.github.com/users/delta4d/followers","following_url":"https://api.github.com/users/delta4d/following{/other_user}","gists_url":"https://api.github.com/users/delta4d/gists{/gist_id}","starred_url":"https://api.github.com/users/delta4d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta4d/subscriptions","organizations_url":"https://api.github.com/users/delta4d/orgs","repos_url":"https://api.github.com/users/delta4d/repos","events_url":"https://api.github.com/users/delta4d/events{/privacy}","received_events_url":"https://api.github.com/users/delta4d/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-27T13:08:24Z","updated_at":"2015-09-15T01:23:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/paul/progress_bar/pulls/31","html_url":"https://github.com/paul/progress_bar/pull/31","diff_url":"https://github.com/paul/progress_bar/pull/31.diff","patch_url":"https://github.com/paul/progress_bar/pull/31.patch"},"body":"in `ProgressBar#render_bar`\r\n\r\n`(ratio * (bar_width - 2)).ceil + ((1-ratio) * (bar_width - 2)).floor` is not always equal to `bar_width - 2`\r\n\r\nfor example, with `@count = 5`, `@max = 17`, `ratio = 5.0/17.0`, `bar_width - 2 = 34`, the result of left is 33, not 34."},"comment":{"url":"https://api.github.com/repos/paul/progress_bar/issues/comments/140247087","html_url":"https://github.com/paul/progress_bar/pull/31#issuecomment-140247087","issue_url":"https://api.github.com/repos/paul/progress_bar/issues/31","id":140247087,"user":{"login":"delta4d","id":2194462,"avatar_url":"https://avatars.githubusercontent.com/u/2194462?v=3","gravatar_id":"","url":"https://api.github.com/users/delta4d","html_url":"https://github.com/delta4d","followers_url":"https://api.github.com/users/delta4d/followers","following_url":"https://api.github.com/users/delta4d/following{/other_user}","gists_url":"https://api.github.com/users/delta4d/gists{/gist_id}","starred_url":"https://api.github.com/users/delta4d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta4d/subscriptions","organizations_url":"https://api.github.com/users/delta4d/orgs","repos_url":"https://api.github.com/users/delta4d/repos","events_url":"https://api.github.com/users/delta4d/events{/privacy}","received_events_url":"https://api.github.com/users/delta4d/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T01:23:34Z","updated_at":"2015-09-15T01:23:34Z","body":"Hi, thank you for reply.\r\n\r\nMy terminal width is 80. And sorry I am not familiar with rspec right now.\r\n\r\nThe following ruby code may fail.\r\n\r\n```ruby\r\n# terminal_width 80\r\n# bar_width 36\r\n\r\nrequire'progress_bar'\r\n\r\nMAX = 17\r\n\r\ndef width count\r\n  bar = ProgressBar.new MAX\r\n  bar.count = count\r\n  bar.to_s.length\r\nend\r\n\r\nputs width(4) # 80\r\nputs width(5) # 79\r\n```\r\n\r\nThe failing test is `bar_spec#at count=25`, the expected `#`s length is `25/100*10=2.5`, if it is rounded down, the expected output is `[##________]`, not the original `[###_______]` in bar_spec.rb."}}