Let's look at an innocuous piece of ruby. Consider some view code showing a user's name and phone number:
"#{first_name} #{last_name} #{phone}"Great - this is very succinct, readable, and can easily be extracted to a method in a
| apiVersion: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: example | |
| namespace: default | |
| data: | |
| APPLICATION_HOST: example.com | |
| LANG: en_US.UTF-8 | |
| PIDFILE: /tmp/server.pid | |
| PORT: "3000" |
| package main | |
| import ( | |
| "net" | |
| "os/exec" | |
| "github.com/k0kubun/pp" | |
| ) | |
| func Hosts(cidr string) ([]string, error) { |
| RSpec.configure do |config| | |
| config.before(:suite) do | |
| DatabaseCleaner.clean_with(:truncation) | |
| end | |
| config.before(:each) do | |
| DatabaseCleaner.strategy = :transaction | |
| end | |
| config.before(:each, js: true) do |