{"action":"created","issue":{"url":"https://api.github.com/repos/zoffixznet/IOwesomeness/issues/5","repository_url":"https://api.github.com/repos/zoffixznet/IOwesomeness","labels_url":"https://api.github.com/repos/zoffixznet/IOwesomeness/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/zoffixznet/IOwesomeness/issues/5/comments","events_url":"https://api.github.com/repos/zoffixznet/IOwesomeness/issues/5/events","html_url":"https://github.com/zoffixznet/IOwesomeness/issues/5","id":216948858,"number":5,"title":"AP: Expand Features of IO::Path.extension","user":{"login":"zoffixznet","id":5747918,"avatar_url":"https://avatars1.githubusercontent.com/u/5747918?v=3","gravatar_id":"","url":"https://api.github.com/users/zoffixznet","html_url":"https://github.com/zoffixznet","followers_url":"https://api.github.com/users/zoffixznet/followers","following_url":"https://api.github.com/users/zoffixznet/following{/other_user}","gists_url":"https://api.github.com/users/zoffixznet/gists{/gist_id}","starred_url":"https://api.github.com/users/zoffixznet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoffixznet/subscriptions","organizations_url":"https://api.github.com/users/zoffixznet/orgs","repos_url":"https://api.github.com/users/zoffixznet/repos","events_url":"https://api.github.com/users/zoffixznet/events{/privacy}","received_events_url":"https://api.github.com/users/zoffixznet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-03-25T04:29:17Z","updated_at":"2017-03-28T18:23:14Z","closed_at":null,"body":""},"comment":{"url":"https://api.github.com/repos/zoffixznet/IOwesomeness/issues/comments/289860241","html_url":"https://github.com/zoffixznet/IOwesomeness/issues/5#issuecomment-289860241","issue_url":"https://api.github.com/repos/zoffixznet/IOwesomeness/issues/5","id":289860241,"user":{"login":"molecules","id":345060,"avatar_url":"https://avatars2.githubusercontent.com/u/345060?v=3","gravatar_id":"","url":"https://api.github.com/users/molecules","html_url":"https://github.com/molecules","followers_url":"https://api.github.com/users/molecules/followers","following_url":"https://api.github.com/users/molecules/following{/other_user}","gists_url":"https://api.github.com/users/molecules/gists{/gist_id}","starred_url":"https://api.github.com/users/molecules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molecules/subscriptions","organizations_url":"https://api.github.com/users/molecules/orgs","repos_url":"https://api.github.com/users/molecules/repos","events_url":"https://api.github.com/users/molecules/events{/privacy}","received_events_url":"https://api.github.com/users/molecules/received_events","type":"User","site_admin":false},"created_at":"2017-03-28T18:23:14Z","updated_at":"2017-03-28T18:23:14Z","body":"Thanks for the clarification on `'foo.txt.tar.gz'.IO.extension(:4parts)` being a no-op.\r\n\r\n### Thoughts on replacing leading period (i.e. replacing `ext` versus `.ext`)\r\nMy first thought was that \r\n\r\n`'foo.txt.tar.gz'.IO.extension('').say` would print `foo.txt.tar` and that\r\n`'foo.txt.tar.gz'.IO.extension('zip').say` would print `foo.txt.tar.zip`.\r\n\r\nHowever, now I see that those are inconsistent in that the first replaced the string `.gz` and the second only replaced the string `gz`.\r\n\r\nSo for consistency, I think I'd prefer needing to include the period myself:\r\n`'foo.txt.tar.gz'.IO.extension('').say; # foo.txt.tar`\r\n`'foo.txt.tar.gz'.IO.extension('.zip').say; # foo.txt.tar.zip`\r\n\r\nThis also facilitates modifying part of an extensions to make it become part of the main part of the file name (not uncommon in my work):\r\n`'foo.txt.tar.gz'.IO.extension('_txt.tar.gz', :3parts).say` to print `foo_txt.tar.gz`\r\n\r\n----\r\n\r\nSaying that just now, I see that my previous lists of examples were inconsistent. So I've touched them up. Please let me know if I'm understanding this correctly.\r\n\r\n## Examples revisited (assuming replacement of `.ext` instead of `ext`)\r\n\r\n### Replacement\r\n```\r\n'foo.txt'.IO.extension('.doc'        ).say; # foo.doc\r\n'foo.txt'.IO.extension('.doc',:1parts).say; # foo.doc\r\n\r\n'foo.txt.tar.gz'.IO.extension('.zip'         ).say; # foo.txt.tar.zip\r\n'foo.txt.tar.gz'.IO.extension('.zip', :1parts).say; # foo.txt.tar.zip\r\n'foo.txt.tar.gz'.IO.extension('.zip', :2parts).say; # foo.txt.zip\r\n'foo.txt.tar.gz'.IO.extension('.zip', :3parts).say; # foo.zip\r\n'foo.txt.tar.gz'.IO.extension('.zip', :4parts).say; # foo.txt.tar.gz (no-op since there is no 4-part extension)\r\n```\r\n\r\n### Appending\r\n```\r\n'foo.txt.tar'.IO.extension('.gz',:0parts).say; # foo.txt.tar.gz\r\n```\r\n### Removal\r\n```\r\n'foo.txt'.IO.extension('').say; # foo\r\n'bar.zip'.IO.extension('').say; # bar\r\n```\r\n\r\n### Misc \r\nAnd if someone really does want it ending in a period, they can make it so:\r\n\r\n```\r\n'foo.txt'.IO.extension('.').say; # foo.\r\n```"}}
{"actor":{"display_login":"molecules"}}