Skip to content

Instantly share code, notes, and snippets.

@dmehrotra
Created August 26, 2013 15:25
Show Gist options
  • Select an option

  • Save dmehrotra/6342681 to your computer and use it in GitHub Desktop.

Select an option

Save dmehrotra/6342681 to your computer and use it in GitHub Desktop.
constructors
class Television
def initialize(manufacturor, size, resolution = nil, flatscreen? = false)
@manufacturor = manufacturor
@size = size
if resolution.nil?
@resolution = 'not sure'
else
@resolution = resolution
end
if flatscreen?
puts 'you lucky dog'
@flatscreen = flatscreen
else
@flatscreen = flatscreen
end
end
end
class Channel
def initialize(station, channel)
@station = station
@channel = channel
end
end
class Show
def initialize(station, title, time)
@station = station
@title = title
@time = time
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment