Skip to content

Instantly share code, notes, and snippets.

@chrisle chrisle/gist:5774203
Created Jun 13, 2013

Embed
What would you like to do?
class Puzzle
attr_accessor :field
def initialize
self.field = true
end
def run
puts field.inspect # => true
if false
field = "NEVER SET"
end
puts field.inspect # => ? << ** this is TRUE
end
end
what_is_run = Puzzle.new.run
puts what_is_run # => nil
#######################
class Puzzle
attr_accessor :field
def initialize
self.field = true
end
def run
puts field.inspect # => true
if false
field = "NEVER SET"
end
puts field.inspect
field # ADDED
end
end
what_is_run = Puzzle.new.run
puts what_is_run # => TRUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.