Click and copy text into file or database using mouse event


am new at ruby and searching for a way to highlight a word in a text
through a mouse-click and then copy the highlighted word into a file by
evaluating the mouse event (highlighted area) or hotkeys.

Is there a way in ruby to do this?

Thanks in advance.