Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created June 9, 2016 17:48
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 anonymous/4396cac10346782ede8e9aa2bb279690 to your computer and use it in GitHub Desktop.
Save anonymous/4396cac10346782ede8e9aa2bb279690 to your computer and use it in GitHub Desktop.
class YesImAClass
@how_we_usually_do_it="blah"
def active_overlay
@active_overlay ||= (some_method_to_determine_value(...)) ? 'opton 1' : 'option 2'
end
def self.some_method
AnotherClass.foo(@active_overlay)
end
end
# Call YesImAClass.some_method and @active_overlay goes from not set to set
# Call YesImAClass.some_method and @active_overlay is already set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment