Skip to content

Instantly share code, notes, and snippets.

@aytch
Created March 2, 2013 06:30
Show Gist options
  • Select an option

  • Save aytch/5069930 to your computer and use it in GitHub Desktop.

Select an option

Save aytch/5069930 to your computer and use it in GitHub Desktop.
Photography and OOP: Understanding OOP
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