class Commander attr_accessor :command def initialize(command) @command = command end def on_button_push @command.execute if @command endendclass YourCommand def execute endendsave_button = Commander.new( YourCommand.new )