{"id":18319784,"url":"https://github.com/redding/much-boolean","last_synced_at":"2025-04-09T14:22:43.314Z","repository":{"id":55102510,"uuid":"49343684","full_name":"redding/much-boolean","owner":"redding","description":"An API for friendly boolean conversion, interpretation and handling","archived":false,"fork":false,"pushed_at":"2021-01-10T14:21:15.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-03-15T12:12:17.220Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-09T22:20:40.000Z","updated_at":"2021-01-10T14:21:14.000Z","dependencies_parsed_at":"2022-08-14T12:01:00.175Z","dependency_job_id":null,"html_url":"https://github.com/redding/much-boolean","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-boolean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-boolean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-boolean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-boolean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redding","download_url":"https://codeload.github.com/redding/much-boolean/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054200,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:14:15.101Z","updated_at":"2025-04-09T14:22:43.279Z","avatar_url":"https://github.com/redding.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MuchBoolean\n\nAn API for friendly boolean conversion, interpretation and handling\n\n## Usage\n\n```ruby\nrequire \"much-boolean\"\nMuchBoolean::FALSE_VALUES # =\u003e [ 0, \"0\",\n                          #      false, \"false\", \"False\", \"FALSE\", \"f\", \"F\",\n                          #      \"no\", \"No\", \"NO\", \"n\", \"N\"\n                          #    ]\n\n\n# convert human-friendly representative values to actual booleans\n\n# nil and empty-string values\nMuchBoolean.convert(nil) # =\u003e false\nMuchBoolean.convert(\"\")  # =\u003e false\nMuchBoolean.convert(:\"\") # =\u003e false\n\n# zero/one type values\nMuchBoolean.convert(0)    # =\u003e false\nMuchBoolean.convert(\"0\")  # =\u003e false\nMuchBoolean.convert(:\"0\") # =\u003e false\nMuchBoolean.convert(1)    # =\u003e true\nMuchBoolean.convert(\"1\")  # =\u003e true\nMuchBoolean.convert(:\"1\") # =\u003e true\n\n# true/false type values\nMuchBoolean.convert(false)   # =\u003e false\nMuchBoolean.convert(\"f\")     # =\u003e false\nMuchBoolean.convert(:f)      # =\u003e false\nMuchBoolean.convert(\"F\")     # =\u003e false\nMuchBoolean.convert(:F)      # =\u003e false\nMuchBoolean.convert(\"false\") # =\u003e false\nMuchBoolean.convert(:false)  # =\u003e false\nMuchBoolean.convert(\"False\") # =\u003e false\nMuchBoolean.convert(:False)  # =\u003e false\nMuchBoolean.convert(\"FALSE\") # =\u003e false\nMuchBoolean.convert(:FALSE)  # =\u003e false\nMuchBoolean.convert(true)    # =\u003e true\nMuchBoolean.convert(\"t\")     # =\u003e true\nMuchBoolean.convert(:t)      # =\u003e true\nMuchBoolean.convert(\"T\")     # =\u003e true\nMuchBoolean.convert(:T)      # =\u003e true\nMuchBoolean.convert(\"true\")  # =\u003e true\nMuchBoolean.convert(:true)   # =\u003e true\nMuchBoolean.convert(\"True\")  # =\u003e true\nMuchBoolean.convert(:True)   # =\u003e true\nMuchBoolean.convert(\"TRUE\")  # =\u003e true\nMuchBoolean.convert(:TRUE)   # =\u003e true\n\n# on/off type values\nMuchBoolean.convert(\"off\") # =\u003e false\nMuchBoolean.convert(:off)  # =\u003e false\nMuchBoolean.convert(\"Off\") # =\u003e false\nMuchBoolean.convert(:Off)  # =\u003e false\nMuchBoolean.convert(\"OFF\") # =\u003e false\nMuchBoolean.convert(:OFF)  # =\u003e false\nMuchBoolean.convert(\"on\")  # =\u003e true\nMuchBoolean.convert(:on)   # =\u003e true\nMuchBoolean.convert(\"On\")  # =\u003e true\nMuchBoolean.convert(:On)   # =\u003e true\nMuchBoolean.convert(\"ON\")  # =\u003e true\nMuchBoolean.convert(:ON)   # =\u003e true\n\n# yes/no type values\nMuchBoolean.convert(\"n\")   # =\u003e false\nMuchBoolean.convert(:n)    # =\u003e false\nMuchBoolean.convert(\"N\")   # =\u003e false\nMuchBoolean.convert(:N)    # =\u003e false\nMuchBoolean.convert(\"no\")  # =\u003e false\nMuchBoolean.convert(:no)   # =\u003e false\nMuchBoolean.convert(\"No\")  # =\u003e false\nMuchBoolean.convert(:No)   # =\u003e false\nMuchBoolean.convert(\"NO\")  # =\u003e false\nMuchBoolean.convert(:NO)   # =\u003e false\nMuchBoolean.convert(\"y\")   # =\u003e true\nMuchBoolean.convert(:y)    # =\u003e true\nMuchBoolean.convert(\"Y\")   # =\u003e true\nMuchBoolean.convert(:Y)    # =\u003e true\nMuchBoolean.convert(\"yes\") # =\u003e true\nMuchBoolean.convert(:yes)  # =\u003e true\nMuchBoolean.convert(\"Yes\") # =\u003e true\nMuchBoolean.convert(:Yes)  # =\u003e true\nMuchBoolean.convert(\"YES\") # =\u003e true\nMuchBoolean.convert(:YES)  # =\u003e true\n\n# all other values always interpreted as `true`\nMuchBoolean.convert(\"some-string\") # =\u003e true\nMuchBoolean.convert(1938)          # =\u003e true\nMuchBoolean.convert(1938.5)        # =\u003e true\nMuchBoolean.convert(Date.today)    # =\u003e true\nMuchBoolean.convert(Time.now)      # =\u003e true\n\n\n# convert actual booleans back to human-friendly representative values\n\nMuchBoolean.one_zero(true)       # =\u003e 1\nMuchBoolean.one_zero(false)      # =\u003e 0\nMuchBoolean.one_zero(true).to_s  # =\u003e \"1\"\nMuchBoolean.one_zero(false).to_s # =\u003e \"0\"\n\nMuchBoolean.t_f(true)         # =\u003e \"t\"\nMuchBoolean.t_f(false)        # =\u003e \"f\"\nMuchBoolean.T_F(true)         # =\u003e \"T\"\nMuchBoolean.T_F(false)        # =\u003e \"F\"\nMuchBoolean.true_false(true)  # =\u003e \"true\"\nMuchBoolean.true_false(false) # =\u003e \"false\"\nMuchBoolean.True_False(true)  # =\u003e \"True\"\nMuchBoolean.True_False(false) # =\u003e \"False\"\nMuchBoolean.TRUE_FALSE(true)  # =\u003e \"TRUE\"\nMuchBoolean.TRUE_FALSE(false) # =\u003e \"FALSE\"\n\nMuchBoolean.on_off(true)  # =\u003e \"on\"\nMuchBoolean.on_off(false) # =\u003e \"off\"\nMuchBoolean.On_Off(true)  # =\u003e \"On\"\nMuchBoolean.On_Off(false) # =\u003e \"Off\"\nMuchBoolean.ON_OFF(true)  # =\u003e \"ON\"\nMuchBoolean.ON_OFF(false) # =\u003e \"OFF\"\n\nMuchBoolean.y_n(true)     # =\u003e \"y\"\nMuchBoolean.y_n(false)    # =\u003e \"n\"\nMuchBoolean.Y_N(true)     # =\u003e \"Y\"\nMuchBoolean.Y_N(false)    # =\u003e \"N\"\nMuchBoolean.yes_no(true)  # =\u003e \"yes\"\nMuchBoolean.yes_no(false) # =\u003e \"no\"\nMuchBoolean.Yes_No(true)  # =\u003e \"Yes\"\nMuchBoolean.Yes_No(false) # =\u003e \"No\"\nMuchBoolean.YES_NO(true)  # =\u003e \"YES\"\nMuchBoolean.YES_NO(false) # =\u003e \"NO\"\n\n\n# create instances to track given human-friendly values and the boolean values they map to\n\nbool = MuchBoolean.new\nbool.given  # =\u003e nil\nbool.actual # =\u003e nil\n\nMuchBoolean::FALSE_VALUES.each do |val|\n  bool = MuchBoolean.new(val)\n  bool.given    # =\u003e {val}\n  bool.actual   # =\u003e false\n  bool == false # =\u003e true\n  bool == true  # =\u003e false\nend\n\n[\"some-string\", 1938, 1938.5, Date.today, Time.now].each do |val|\n  bool = MuchBoolean.new(val)\n  bool.given    # =\u003e {val}\n  bool.actual   # =\u003e true\n  bool == true  # =\u003e true\n  bool == false # =\u003e false\nend\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem \"much-boolean\"\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install much-boolean\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fmuch-boolean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredding%2Fmuch-boolean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fmuch-boolean/lists"}