Created
March 2, 2013 06:30
-
-
Save aytch/5069930 to your computer and use it in GitHub Desktop.
Photography and OOP: Understanding OOP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Picture | |
| def exposure(light_level, depth_of_field, motion_capture) | |
| def light_level() | |
| if light_level == "daylight" | |
| iso=200 | |
| elsif light_level == "night" | |
| iso = 1600 | |
| else | |
| iso = 800 | |
| end | |
| def depth_of_field(scene) | |
| case scene | |
| when scene = "landscape" | |
| aperture = 'f\22' | |
| when scene = "portrait" | |
| aperture = 'f2.8' | |
| else | |
| aperture = 8 | |
| end | |
| end | |
| def motion_capture(speed) | |
| case speed | |
| when speed == "slow" | |
| shutter_speed = "bulb" | |
| when speed == "flash" | |
| shutter_speed = "1/250" | |
| when speed == "sports" | |
| shutter_speed = "1/2000" | |
| else | |
| puts "Shutter speed not set!" | |
| end | |
| end | |
| end | |
| photo1 = Picture::new.exposure("daylight", "shallow", "sports") | |
| photo2 = Picture::new.exposure("night", "landscape", "slow") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment