I'm working on a plugin that needs to allow for some functions to be swapped out for custom ones. When I do the swap, the function runs, but it needs to have access to the options/variables that are inside the plugin. I've tried searching around, but I'm probably searching for the wrong thing. I'd appreciate help if anyone knows what I'm trying to do:

    $.fn.test = function( options ){

        /* Set defaults */
        var defaults = {
            some_value: 'a',
            do_something: function(){
                alert('this is the default function');

        /* Override defaults with options */
        var options = $.extend( defaults, options );

            console.log( options.do_something() );

    do_something: function(){

        // ReferenceError: options is not defined
        alert( options.some_value );

        // What I really want to do is set some_value
        options.some_value = 'b';
jsfiddle: http://jsfiddle.net/BCwm4/