{"action":"opened","number":25,"pull_request":{"url":"https://api.github.com/repos/dry-rb/dry-logic/pulls/25","id":91494515,"html_url":"https://github.com/dry-rb/dry-logic/pull/25","diff_url":"https://github.com/dry-rb/dry-logic/pull/25.diff","patch_url":"https://github.com/dry-rb/dry-logic/pull/25.patch","issue_url":"https://api.github.com/repos/dry-rb/dry-logic/issues/25","number":25,"state":"open","locked":false,"title":"add non_whitespace? predicate","user":{"login":"georgemillo","id":2656485,"avatar_url":"https://avatars.githubusercontent.com/u/2656485?v=3","gravatar_id":"","url":"https://api.github.com/users/georgemillo","html_url":"https://github.com/georgemillo","followers_url":"https://api.github.com/users/georgemillo/followers","following_url":"https://api.github.com/users/georgemillo/following{/other_user}","gists_url":"https://api.github.com/users/georgemillo/gists{/gist_id}","starred_url":"https://api.github.com/users/georgemillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgemillo/subscriptions","organizations_url":"https://api.github.com/users/georgemillo/orgs","repos_url":"https://api.github.com/users/georgemillo/repos","events_url":"https://api.github.com/users/georgemillo/events{/privacy}","received_events_url":"https://api.github.com/users/georgemillo/received_events","type":"User","site_admin":false},"body":"See https://github.com/dry-rb/dry-validation/issues/213\r\n\r\nThis is such a common use case (testing that a string is not only non-empty but contains non-whitespace characters, à la `String#present?` if you're using ActiveSupport) that I feel it makes perfect sense to include as a 'core' predicate.\r\n\r\nHowever, I don't think `filled_str?` (which @solnic suggested in https://github.com/dry-rb/dry-validation/issues/213) is a good name, mainly because it uses the word \"filled\" in a way that's inconsistent with the existing `filled?` method: `str?(\"\") && filled?(\"str\") != filled_str?(\"\")`, which don't make sense. `non_whitespace?` is the clearest name I could come up with... although there might be something better.\r\n\r\nNote that if you pass an object where the concept 'non whitespace' doesn't make sense (e.g. an Array or a Hash), this predicate will raise an error. (This is only true because I've written it like \"regex =~ input\"; if it was \"input =~ regex\" then non-stringy objects would just return `nil`. I feel like raising an error makes more sense since if you're calling `non_whitespace` on an Array or an Integer etc. you're probably doing something wrong somewhere. \r\n\r\nIs raising an error the right approach? Some other predicates already do it, e.g. `key?` will raise an error if passed an object that doesn't respond to `key?`.","created_at":"2016-10-29T16:43:33Z","updated_at":"2016-10-29T16:43:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dry-rb/dry-logic/pulls/25/commits","review_comments_url":"https://api.github.com/repos/dry-rb/dry-logic/pulls/25/comments","review_comment_url":"https://api.github.com/repos/dry-rb/dry-logic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dry-rb/dry-logic/issues/25/comments","statuses_url":"https://api.github.com/repos/dry-rb/dry-logic/statuses/d018e4ff74e017682ea278c7ebe80e4d36b709d2","head":{"label":"georgemillo:non-whitespace-predicate","ref":"non-whitespace-predicate","sha":"d018e4ff74e017682ea278c7ebe80e4d36b709d2","user":{"login":"georgemillo","id":2656485,"avatar_url":"https://avatars.githubusercontent.com/u/2656485?v=3","gravatar_id":"","url":"https://api.github.com/users/georgemillo","html_url":"https://github.com/georgemillo","followers_url":"https://api.github.com/users/georgemillo/followers","following_url":"https://api.github.com/users/georgemillo/following{/other_user}","gists_url":"https://api.github.com/users/georgemillo/gists{/gist_id}","starred_url":"https://api.github.com/users/georgemillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgemillo/subscriptions","organizations_url":"https://api.github.com/users/georgemillo/orgs","repos_url":"https://api.github.com/users/georgemillo/repos","events_url":"https://api.github.com/users/georgemillo/events{/privacy}","received_events_url":"https://api.github.com/users/georgemillo/received_events","type":"User","site_admin":false},"repo":{"id":72286814,"name":"dry-logic","full_name":"georgemillo/dry-logic","owner":{"login":"georgemillo","id":2656485,"avatar_url":"https://avatars.githubusercontent.com/u/2656485?v=3","gravatar_id":"","url":"https://api.github.com/users/georgemillo","html_url":"https://github.com/georgemillo","followers_url":"https://api.github.com/users/georgemillo/followers","following_url":"https://api.github.com/users/georgemillo/following{/other_user}","gists_url":"https://api.github.com/users/georgemillo/gists{/gist_id}","starred_url":"https://api.github.com/users/georgemillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgemillo/subscriptions","organizations_url":"https://api.github.com/users/georgemillo/orgs","repos_url":"https://api.github.com/users/georgemillo/repos","events_url":"https://api.github.com/users/georgemillo/events{/privacy}","received_events_url":"https://api.github.com/users/georgemillo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/georgemillo/dry-logic","description":"Predicate logic with rule composition","fork":true,"url":"https://api.github.com/repos/georgemillo/dry-logic","forks_url":"https://api.github.com/repos/georgemillo/dry-logic/forks","keys_url":"https://api.github.com/repos/georgemillo/dry-logic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/georgemillo/dry-logic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/georgemillo/dry-logic/teams","hooks_url":"https://api.github.com/repos/georgemillo/dry-logic/hooks","issue_events_url":"https://api.github.com/repos/georgemillo/dry-logic/issues/events{/number}","events_url":"https://api.github.com/repos/georgemillo/dry-logic/events","assignees_url":"https://api.github.com/repos/georgemillo/dry-logic/assignees{/user}","branches_url":"https://api.github.com/repos/georgemillo/dry-logic/branches{/branch}","tags_url":"https://api.github.com/repos/georgemillo/dry-logic/tags","blobs_url":"https://api.github.com/repos/georgemillo/dry-logic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/georgemillo/dry-logic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/georgemillo/dry-logic/git/refs{/sha}","trees_url":"https://api.github.com/repos/georgemillo/dry-logic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/georgemillo/dry-logic/statuses/{sha}","languages_url":"https://api.github.com/repos/georgemillo/dry-logic/languages","stargazers_url":"https://api.github.com/repos/georgemillo/dry-logic/stargazers","contributors_url":"https://api.github.com/repos/georgemillo/dry-logic/contributors","subscribers_url":"https://api.github.com/repos/georgemillo/dry-logic/subscribers","subscription_url":"https://api.github.com/repos/georgemillo/dry-logic/subscription","commits_url":"https://api.github.com/repos/georgemillo/dry-logic/commits{/sha}","git_commits_url":"https://api.github.com/repos/georgemillo/dry-logic/git/commits{/sha}","comments_url":"https://api.github.com/repos/georgemillo/dry-logic/comments{/number}","issue_comment_url":"https://api.github.com/repos/georgemillo/dry-logic/issues/comments{/number}","contents_url":"https://api.github.com/repos/georgemillo/dry-logic/contents/{+path}","compare_url":"https://api.github.com/repos/georgemillo/dry-logic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/georgemillo/dry-logic/merges","archive_url":"https://api.github.com/repos/georgemillo/dry-logic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/georgemillo/dry-logic/downloads","issues_url":"https://api.github.com/repos/georgemillo/dry-logic/issues{/number}","pulls_url":"https://api.github.com/repos/georgemillo/dry-logic/pulls{/number}","milestones_url":"https://api.github.com/repos/georgemillo/dry-logic/milestones{/number}","notifications_url":"https://api.github.com/repos/georgemillo/dry-logic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/georgemillo/dry-logic/labels{/name}","releases_url":"https://api.github.com/repos/georgemillo/dry-logic/releases{/id}","deployments_url":"https://api.github.com/repos/georgemillo/dry-logic/deployments","created_at":"2016-10-29T13:35:53Z","updated_at":"2016-10-29T13:35:54Z","pushed_at":"2016-10-29T16:15:24Z","git_url":"git://github.com/georgemillo/dry-logic.git","ssh_url":"git@github.com:georgemillo/dry-logic.git","clone_url":"https://github.com/georgemillo/dry-logic.git","svn_url":"https://github.com/georgemillo/dry-logic","homepage":null,"size":194,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dry-rb:master","ref":"master","sha":"8e85da2f9177fc181405eb436ba1600eb01a3e40","user":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"repo":{"id":49417543,"name":"dry-logic","full_name":"dry-rb/dry-logic","owner":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dry-rb/dry-logic","description":"Predicate logic with rule composition","fork":false,"url":"https://api.github.com/repos/dry-rb/dry-logic","forks_url":"https://api.github.com/repos/dry-rb/dry-logic/forks","keys_url":"https://api.github.com/repos/dry-rb/dry-logic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dry-rb/dry-logic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dry-rb/dry-logic/teams","hooks_url":"https://api.github.com/repos/dry-rb/dry-logic/hooks","issue_events_url":"https://api.github.com/repos/dry-rb/dry-logic/issues/events{/number}","events_url":"https://api.github.com/repos/dry-rb/dry-logic/events","assignees_url":"https://api.github.com/repos/dry-rb/dry-logic/assignees{/user}","branches_url":"https://api.github.com/repos/dry-rb/dry-logic/branches{/branch}","tags_url":"https://api.github.com/repos/dry-rb/dry-logic/tags","blobs_url":"https://api.github.com/repos/dry-rb/dry-logic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dry-rb/dry-logic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dry-rb/dry-logic/git/refs{/sha}","trees_url":"https://api.github.com/repos/dry-rb/dry-logic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dry-rb/dry-logic/statuses/{sha}","languages_url":"https://api.github.com/repos/dry-rb/dry-logic/languages","stargazers_url":"https://api.github.com/repos/dry-rb/dry-logic/stargazers","contributors_url":"https://api.github.com/repos/dry-rb/dry-logic/contributors","subscribers_url":"https://api.github.com/repos/dry-rb/dry-logic/subscribers","subscription_url":"https://api.github.com/repos/dry-rb/dry-logic/subscription","commits_url":"https://api.github.com/repos/dry-rb/dry-logic/commits{/sha}","git_commits_url":"https://api.github.com/repos/dry-rb/dry-logic/git/commits{/sha}","comments_url":"https://api.github.com/repos/dry-rb/dry-logic/comments{/number}","issue_comment_url":"https://api.github.com/repos/dry-rb/dry-logic/issues/comments{/number}","contents_url":"https://api.github.com/repos/dry-rb/dry-logic/contents/{+path}","compare_url":"https://api.github.com/repos/dry-rb/dry-logic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dry-rb/dry-logic/merges","archive_url":"https://api.github.com/repos/dry-rb/dry-logic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dry-rb/dry-logic/downloads","issues_url":"https://api.github.com/repos/dry-rb/dry-logic/issues{/number}","pulls_url":"https://api.github.com/repos/dry-rb/dry-logic/pulls{/number}","milestones_url":"https://api.github.com/repos/dry-rb/dry-logic/milestones{/number}","notifications_url":"https://api.github.com/repos/dry-rb/dry-logic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dry-rb/dry-logic/labels{/name}","releases_url":"https://api.github.com/repos/dry-rb/dry-logic/releases{/id}","deployments_url":"https://api.github.com/repos/dry-rb/dry-logic/deployments","created_at":"2016-01-11T10:02:44Z","updated_at":"2016-10-09T19:53:01Z","pushed_at":"2016-10-29T16:43:33Z","git_url":"git://github.com/dry-rb/dry-logic.git","ssh_url":"git@github.com:dry-rb/dry-logic.git","clone_url":"https://github.com/dry-rb/dry-logic.git","svn_url":"https://github.com/dry-rb/dry-logic","homepage":null,"size":201,"stargazers_count":39,"watchers_count":39,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":5,"forks":8,"open_issues":5,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dry-rb/dry-logic/pulls/25"},"html":{"href":"https://github.com/dry-rb/dry-logic/pull/25"},"issue":{"href":"https://api.github.com/repos/dry-rb/dry-logic/issues/25"},"comments":{"href":"https://api.github.com/repos/dry-rb/dry-logic/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/dry-rb/dry-logic/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/dry-rb/dry-logic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dry-rb/dry-logic/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/dry-rb/dry-logic/statuses/d018e4ff74e017682ea278c7ebe80e4d36b709d2"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":44,"deletions":2,"changed_files":4}}
{"actor":{"display_login":"georgemillo"}}