Ruby (and Rails) have many ways to test whether something is … present. But each method behaves slightly differently, and some are Ruby-native while some are added by Rails. Here’s the summary, in case you don’t feel like reading the full details below: .nil? (Ruby) .empty? (Ruby) .blank? (Rails) .present? (Rails) true false NoMethodError […]
Archives for August 2023
JSON in Python
Working with JSON in Python relies on Python’s builtin json module. After you import json, here are the json module methods: Notice that the methods ending in “s” deal directly with strings, whereas the others deal with files. To disambiguate them, I call them “load string” and “dump string” (in my own head, at least). […]