{"id":26057510,"url":"https://github.com/folkengine/shrift","last_synced_at":"2025-10-08T01:06:49.429Z","repository":{"id":56895444,"uuid":"57680030","full_name":"folkengine/shrift","owner":"folkengine","description":"Ruby utility library to make short shrift of objects.","archived":false,"fork":false,"pushed_at":"2019-01-20T18:02:55.000Z","size":30,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T14:19:18.288Z","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/folkengine.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-05-01T17:12:47.000Z","updated_at":"2019-01-20T17:57:37.000Z","dependencies_parsed_at":"2022-08-21T01:20:33.176Z","dependency_job_id":null,"html_url":"https://github.com/folkengine/shrift","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/folkengine/shrift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folkengine%2Fshrift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folkengine%2Fshrift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folkengine%2Fshrift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folkengine%2Fshrift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folkengine","download_url":"https://codeload.github.com/folkengine/shrift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folkengine%2Fshrift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259745204,"owners_count":22905064,"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":"2025-03-08T11:23:47.744Z","updated_at":"2025-10-08T01:06:49.343Z","avatar_url":"https://github.com/folkengine.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shrift\n\n[![Gem Version](https://badge.fury.io/rb/shrift.svg)](https://badge.fury.io/rb/shrift)\n[![Build Status](https://travis-ci.org/folkengine/shrift.svg?branch=master)](https://travis-ci.org/folkengine/shrift)\n\nMakes short shrift of objects. \n\n## Warning\n\nThis is alpha software and only works with basic Objects. \n\nShrift is a simple DSL generator that turns Objects to single line Strings for easy storage and debugging. \n\nAn example 'Shrift String' would be:\n\n    example:st15dx14cn10w18i3ch6:4\n\nWhen you split the String on ':', this first cell is a String, the second cell is a 'Shrift Map' of alternating\nfield shorthand Strings and integers, and the third cell maps to an integer. \n\nPass this String back into the Shrift object configured to make short shrift of the class and it will return the Object,\ngood as new.\n\nI created this so that I had a way to pack as much informational punch into as short a space as possible.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'shrift'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install shrift\n\n## Usage\n\nGiven a simple class: \n\n```ruby\nclass Character\n  attr_accessor :character_name, :strength, :dexterity,\n                :constitution, :wisdom, :intelligence, :charisma, :hit_points\n\n  def initialize(character_name = '')\n    @character_name = character_name\n  end\nend\n```\n\nI setup a Shrift that maps the first cell  to character_name, the second cell to a ShriftMap of most of the integer \nfields, and the third field mapped as an integer to hit_points:\n\n```ruby\nshrift_mapper = ShriftMapper.new(hashmap: {\n        ST: 'strength',\n        DX: 'dexterity',\n        CN: 'constitution',\n        W: 'wisdom',\n        I: 'intelligence',\n        CH: 'charisma'})\nshrift = Shrift.new(Character, [ShriftCell.new(:character_name), shrift_mapper, ShriftInt.new(:hit_points)])\n\nbub = Character.new('bub')\nbub.strength = 15\nbub.dexterity = 14\nbub.constitution = 10\nbub.wisdom = 18\nbub.intelligence = 3\nbub.charisma = 6\nbub.hit_points = 4\n\nbubbu_shrift = shrift.short(bub)\n```\n\nThis returns a Shrift String of:\n \n```ruby\nbub:st15dx14cn10w18i3ch6:4\n```\n\nTo turn it back into an Object, I just need to pass the Shrift String into the Shrift's classify method:\n\n```ruby\nnew_bub = @shrift.classify(bubbu_shrift)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/folkengine/shrift.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolkengine%2Fshrift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolkengine%2Fshrift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolkengine%2Fshrift/lists"}