Ruby -- Programming Language

學習

自行撰寫 C API

How to write C extensions easily in Ruby, by Muriel Salvan, 2012.11.21

Gems

漢語拼音

Image / Graphic

在 Ubuntu 上安裝 rmagick

sudo apt-get install libmagick++-dev

sudo gem install rmagick

使用說明

http://www.imagemagick.org/RMagick/doc/

Microsoft Word file

chrahunt/docx

https://github.com/chrahunt/docx

WIN32OLE

http://www.ruby-doc.org/stdlib-2.1.2/libdoc/win32ole/rdoc/WIN32OLE.html

require 'win32ole'
begin
  word = WIN32OLE.connect('Word.Application')
  doc = word.ActiveDocument
rescue
  word = WIN32OLE.new('word.application')
  path_open = 'C:\Users\...\test.doc' #yes: backslashes in windows
  doc = word.Documents.Open(path_open)
end
word.visible = true doc.Sentences.each { |x| puts x.text }