Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Two programmers in one

Two programmers in one

My RubyNation 2014 talk

Jano González

June 07, 2014
Tweet

More Decks by Jano González

Other Decks in Programming

Transcript

  1. THINKER class AccountProtectionProxy def initialize(real_account, owner) @subject = real_account @owner

    = owner end ! def method_missing(name, *args) check_access @subject.send(name, *args) end ...
  2. EXAMPLE case account_type when :premium then # do stuff when

    :standard then # do stuff when :personal then # do stuff end
  3. EXAMPLE class PremiumAccount def initialize # do stuff end !

    def execute(context) # do stuff end end