{"push_id":1141270601,"size":1,"distinct_size":1,"ref":"refs/heads/jcr-add-mixin","head":"5bbeb0e0f1c8e7f5f4e92cf31e01185dd68068c1","before":"586bc7df0b777d11d27ff7e68cf3e0c902412d23","commits":[{"sha":"5bbeb0e0f1c8e7f5f4e92cf31e01185dd68068c1","author":{"name":"Collin Redding","email":"d46f375d8aaf6893782d4503835b61ef3c034b5b@gmail.com"},"message":"Define `MuchDecimal` mixin\n\nThis makes the `MuchDecimal` a mixin that can be used to define\nattributes that are decimals stored as integers. This allows easily\nsetting up attributes that are decimals but store their values as\nintegers. The decimals can be used for presentation/display while\nthe integer can be used for math operations. This is particularly\nuseful when working with currency.\n\nThis brings in much-plugin and makes the main module `MuchDecimal`\na plugin. The plugin simply adds a class method\n`decimal_as_integer` that allows setting up decimal as integer\nattributes. The class method takes an attribute name and a set of\noptions. The source attribute and a precision are the possible\noptions. The source attributes specifies the accessor that the\ninteger will be written to. The precision is the number of decimal\nplaces or how precise you want the integer to be. Both of these are\ndefaulted if they aren't provided.\n\nThe class method defines a reader and writer. The readers reads\nfrom the source accessor expecting an integer and converting it to\nits decimal using the precision. The writer expects a decimal and\nconverts it to an integer using the precision and writes it to the\nsource accessor. Both of these handle `nil` and non numeric values\nappropriately.\n\nFinally, this pulls the conversion logic, decimal to integer and\ninteger to decimal, into singleton methods on the main module.\nThis allows their logic to be used directly. This is particularly\nuseful for testing that an attribute is using much-decimal.","distinct":true,"url":"https://api.github.com/repos/redding/much-decimal/commits/5bbeb0e0f1c8e7f5f4e92cf31e01185dd68068c1"}]}
{"actor":{"display_login":"jcredding"}}