Sha256: 3cf10cae09078802d73fa9ef14bd7eefe48117e83cba97942a9d5e5d25aadd29

Contents?: true

Size: 363 Bytes

Versions: 1

Compression:

Stored size: 363 Bytes

Contents

module Scripted
  module Commands
    class Ruby

      def initialize(code)
        @code = code
      end

      def execute!(log = STDOUT)
        old_stdout = $stdout
        old_stderr = $stderr
        $stdout = log
        $stderr = log
        @code.call
      ensure
        $stdout = old_stdout
        $stderr = old_stderr
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scripted-0.0.1 lib/scripted/commands/ruby.rb