Return to Snippet

Revision: 15659
at July 13, 2009 04:44 by kungfoo


Initial Code
module DocumentFunctions
  module InstanceMethods
    # returns the word that is currently touched by the cursor
    def word_touching_cursor
      
    end
  end
  
  def self.included(receiver)
    receiver.send :include, InstanceMethods
  end
end

module DocumentManipulator
  
  module InstanceMethods
    def document
      
    end
    
    # replace a range with the given text.
    def replace_range(start_offset, stop_offset, text)
      
    end
  end
  
  def self.included(receiver)
    receiver.send :include, InstanceMethods
  end
  
end

module SelectionManipulator
  include DocumentFunctions
  
  module InstanceMethods
    
    def selection
      
    end
  end
  
  def self.included(receiver)
    receiver.send :include, InstanceMethods
  end
  
end

class FooCommand
  include SelectionManipulator
  
  def run
    (self.methods - Object.new.methods).each do |method|
      puts method
    end
  end
end

FooCommand.new.run

Initial URL

                                

Initial Description

                                

Initial Title
Command + Document Responsibility Separation Proposal

Initial Tags
ruby

Initial Language
Ruby