/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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