Skip to content

Instantly share code, notes, and snippets.

@tooky
Last active December 24, 2015 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tooky/6740423 to your computer and use it in GitHub Desktop.
Save tooky/6740423 to your computer and use it in GitHub Desktop.
# Fill in the values after # =>
#
$title = "Ruby Variables"
@subtitle = "Where do they come from?"
presenter = "@tooky"
class Presentation
@@length = "10 min"
@style = "Code"
def self.subtitle
@subtitle
end
def self.style
@style
end
def self.the_presenter
presenter = presenter || "https://github.com/tooky"
presenter
end
def self.length
@@length
end
def self.title
$title
end
def initialize(subtitle)
@subtitle = subtitle
end
def the_presenter
presenter = presenter || "Steve Tooke"
presenter
end
def style
@style
end
def length
@@length
end
def title
$title
end
end
class Talk < Presentation
@@length = "25 min"
@style = "Keynote"
end
a_presentation = Presentation.new("An instance has this effect.")
a_talk = Talk.new("What happens with inheritance?")
$title # =>
@subtitle # =>
presenter # =>
@style # =>
Presentation.style # =>
Presentation.length # =>
Presentation.the_presenter # =>
Talk.style # =>
Talk.length # =>
Talk.the_presenter # =>
a_presentation.style # =>
a_presentation.length # =>
a_presentation.the_presenter # =>
a_talk.style # =>
a_talk.length # =>
a_talk.the_presenter # =>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment