andymeneely / squib

A Ruby DSL for prototyping card games.
http://squib.rocks
MIT License
918 stars 67 forks source link

add x= and /= to extends values #200

Closed sparr closed 7 years ago

sparr commented 7 years ago

This allows inherited values to be multiplied or divided, which is a feature I want for relative font sizes.

Also snuck in a couple of fixes for what look like copy/paste mistakes in the doc examples for +=

sparr commented 7 years ago

I chose x= instead of *= because * has meaning in yaml and would require values to be quoted.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.2%) to 99.402% when pulling 08f39c0327a55fd36b3630501d6f73f1c9b341dc on sparr:master into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

andymeneely commented 7 years ago

Yeah we can do this. The x= is a little unintuitive for me. Does it work to put quotes around it?

x: "*= 5"

Any chance I could get a unit test too? Add some to: https://github.com/andymeneely/squib/blob/master/spec/layout_parser_spec.rb and you can modify this test file (or make your own in this folder) https://github.com/andymeneely/squib/blob/master/spec/data/layouts/extends-units-mixed.yml

sparr commented 7 years ago

x= felt unintuitive for me, too. quotes around *= will work, but then it will be the only one of the four that requires quotes. I guess that's a reasonable price to pay for otherwise intuitiveness.

will follow up with adjusted syntax and docs and unit test momentarily.

andymeneely commented 7 years ago

Yeah I can't decide which is worse. The error message you get when forgetting the quotes is cryptic too and I'll bet we'll get questions about it. Let me think about it for a day or so and we'll decide.

THANK YOU!! Are you on BoardGameGeek? I can give you GeekGold for a microbadge.

sparr commented 7 years ago

I am on BGG, and just made a more complicated question as a comment to the squib thread there, along with an easier(?) question on stackexchange.

sparr commented 7 years ago

Maybe support both x= and *=? that has its own problems, too.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.001%) to 99.641% when pulling 2c92aa13bcda37b446c17271144cc3e274db2545 on sparr:master into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.001%) to 99.641% when pulling 6c61c67376c413b62a7fd7e1161b9d0667722b43 on sparr:master into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

sparr commented 7 years ago

@andymeneely ping regarding deciding between x= or *= or both or something else

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.001%) to 99.612% when pulling 03326420fd7144007ab7431aa4af2eea67e6b5ff on sparr:master into a55300f844a989e7e72e465a667eabde6c080d5e on andymeneely:master.