# File lib/chef/provider/package/rubygems.rb, line 334
        def initialize(new_resource, run_context=nil)
          super
          @cleanup_gem_env = true
          if new_resource.gem_binary
            if new_resource.options && new_resource.options.kind_of?(Hash)
              msg =  "options cannot be given as a hash when using an explicit gem_binary\n"
              msg << "in #{new_resource} from #{new_resource.source_line}"
              raise ArgumentError, msg
            end
            @gem_env = AlternateGemEnvironment.new(new_resource.gem_binary)
            Chef::Log.debug("#{@new_resource} using gem '#{new_resource.gem_binary}'")
          elsif is_omnibus? && (!@new_resource.instance_of? Chef::Resource::ChefGem)
            # Opscode Omnibus - The ruby that ships inside omnibus is only used for Chef
            # Default to installing somewhere more functional
            if new_resource.options && new_resource.options.kind_of?(Hash)
              msg = "options should be a string instead of a hash\n"
              msg << "in #{new_resource} from #{new_resource.source_line}"
              raise ArgumentError, msg
            end
            gem_location = find_gem_by_path
            @new_resource.gem_binary gem_location
            @gem_env = AlternateGemEnvironment.new(gem_location)
            Chef::Log.debug("#{@new_resource} using gem '#{gem_location}'")
          else
            @gem_env = CurrentGemEnvironment.new
            @cleanup_gem_env = false
            Chef::Log.debug("#{@new_resource} using gem from running ruby environment")
          end
        end