What object-oriented programming advice is this code violating?
def check_for_overheating(system_monitor)
if system_monitor.temperature > 100
system_monitor.sound_alarms
end
end| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # This skeleton also assumes you're using the following gems: | |
| # | |
| # rspec-rails: https://github.com/rspec/rspec-rails |
Create a .pgpass file that will be used to provide the password for any libpq-based program for the matching hostname/port/database/user. That file should be chmod'd 0600.
> cat .pgpass
127.0.0.1:5433:database:user:password
Create a SSH tunnel: we open the local port 5433 and, out of the tunnel, go to localhost:5432. You probably really want localhost and not remote: your PostgreSQL database is probably accepting connections only from locahost.
> ssh -N -L 5433:localhost:5432 user@remote
| require 'prawn' | |
| Prawn::Document.generate('crop-marks.pdf') do | |
| spacing = 12 | |
| margin = 100 | |
| canvas do | |
| # topleft corner | |
| stroke_line [bounds.left + spacing, bounds.top - margin], | |
| [bounds.left + margin - spacing, bounds.top - margin] |