SlideShare a Scribd company logo
1 of 199
Download to read offline
My way with Ruby Powered by Rabbit 2.2.2
My way with Ruby
Kouhei Sutou
ClearCode Inc.
RubyKaigi 2018
2018-06-01
My way with Ruby Powered by Rabbit 2.2.2
Ad: Silver sponsor
My way with Ruby Powered by Rabbit 2.2.2
Acknowledgment
感謝
@drbrain
Eric Hodel
He fixed English in this slide
英語をチェックしてくれたよ!ありがとう!
My way with Ruby Powered by Rabbit 2.2.2
Keynote-ish topic
キーノートっぽい話題
Did you think
about it?考えたことある?
My way with Ruby Powered by Rabbit 2.2.2
Keynote-ish topic1
キーノートっぽい話題1
Future未来のこと
My way with Ruby Powered by Rabbit 2.2.2
Keynote-ish topic2
キーノートっぽい話題2
Focus on
one thing
deeplyなにかを深掘り
My way with Ruby Powered by Rabbit 2.2.2
Keynote-ish topic3
キーノートっぽい話題3
Overview俯瞰した話
My way with Ruby Powered by Rabbit 2.2.2
My activities
as a Rubyist
私のRubyist活動
Increase what Ruby can do
with free software
フリーソフトウェアを使ってRubyでできることを増やす
✓
Maintain libraries
ライブラリーのメンテナンス
✓
My way with Ruby Powered by Rabbit 2.2.2
# of libraries maintained
メンテナンスしているライブラリー数
About 130130くらい
My way with Ruby Powered by Rabbit 2.2.2
Today's topic
今日の話題
Overview
what we can do
with RubyRubyでできるようになったことをたくさん紹介
My way with Ruby Powered by Rabbit 2.2.2
How to find targets?
そんなにネタがあるの?
Just I needed単に自分が必要だったから
My way with Ruby Powered by Rabbit 2.2.2
Opening1
きっかけ1
Web feedWebフィード
My way with Ruby Powered by Rabbit 2.2.2
RSS Parser
RSS/Atom parser
with
validationバリデーション機能付きのRSS/Atomパーサー
My way with Ruby Powered by Rabbit 2.2.2
RSS Parser - History
歴史
2003-05: The first release
最初のリリース
No other RSS/Atom parser that
supports validation even now
今でもバリデーション付きのパーサーは他にない
✓
✓
2004-01: Ruby bundles this
RubyがRSS Parserをバンドル
I became a Ruby committer
Rubyコミッターになる
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Validate RSS/Atom
RSS/Atomのバリデーション
Important for me
私にとっては大事
✓
Most wild RSS/Atom feeds are
invalid
野生のRSS/Atomの多くは不正
Validation helps to find problems
バリデーションがあると問題を見つけやすくなる
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
RSS::Parser.parse
# Validates by default
# デフォルトでバリデーション
RSS::Parser.parse(rss)
# Validation can be disabled
# 無効にできる
RSS::Parser.parse(rss, false)
My way with Ruby Powered by Rabbit 2.2.2
Since Ruby 2.6
Ruby 2.6以降
# Supports keyword argument
# キーワード引数対応
parse(rss, validate: false)
My way with Ruby Powered by Rabbit 2.2.2
REXML
XML parser
written in
pure RubyRuby実装のXMLパーサー
My way with Ruby Powered by Rabbit 2.2.2
REXML - History
歴史
2001: Started by Sean Russell
Seanさんが開発を開始
Based on Electric XML (Java)
Java実装のElectric XMLを参考に開発
✓
REXML is "Ruby Electric XML"
REXMLは「Ruby Electric XML」
✓
✓
2003-01: Ruby bundles this
RubyがREXMLをバンドル
✓
My way with Ruby Powered by Rabbit 2.2.2
REXML - Side story
おまけ話
Sean was "書運" in Kanji
Seanさんには「書運」という漢字表記があった
✓
He was interested in Japan
日本好きだった
"How to write your name in Kanji?"
「君の名前は漢字でどう書くの?」
✓
✓
We can connect with Ruby!
RubyistはRubyをきっかけにつながれる!
✓
My way with Ruby Powered by Rabbit 2.2.2
Ad: Code Party
宣伝:コード懇親会
My way with Ruby Powered by Rabbit 2.2.2
Ad: Code Party
宣伝:コード懇親会
This is a challenge
実験的な企画
Ruby focus: to have fun
Rubyは楽しさを大事にしている
✓
We have fun writing Ruby
Rubyistは楽しくRubyを書いている
✓
We have fun together with
writing Ruby at after party!?
だったら懇親会で一緒にRubyを書くと楽しそう!?
✓
My way with Ruby Powered by Rabbit 2.2.2
Ad: Code Party
宣伝:コード懇親会
Matz attends Code Party
まつもとさんもコード懇親会に参加
✓
Sponsored by Speee, Inc.
Speeeさんがスポンサー
✓
My way with Ruby Powered by Rabbit 2.2.2
REXML - Recent1
最近1
2010-08: RubyKaigi 2010
I became the maintainer
私がメンテナーになった
✓
Because RSS Parser uses it
RSS Parserが使っているから
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
REXML - Recent2
最近2
2016: element[attribute_name]
Ruby 2.5 ships it
Ruby 2.5以降で使える
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
REXML - Recent3
最近3
2018: Fix XPath related bugs
XPath関連のバグ修正
Ruby 2.6 ships it
Ruby 2.6以降で使える
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
REXML - Future?
未来はあるの?
Pure Ruby is valuable
Rubyだけで書かれていることには価値がある
Easy to install
インストールが簡単
✓
JIT may improve performance
NOTE: We should improve general logic before we
expect JIT to improve performance
JITで速くなるかもしれない
JITの前に普通にロジックを改良するのが先だけどね
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Recent my works
最近の仕事
XML/HTML libraries for LuaJIT
LuaJIT用のXML/HTMLライブラリー
XMLua: https://clear-code.github.io/xmlua/
libxml2 based XML/HTML parser
✓
LuaCS: https://clear-code.github.io/luacs/
CSS Selectors→XPath converter
✓
✓
Found what is lacking in
REXML API
REXMLのAPIに足りないものはなにか考えた
✓
My way with Ruby Powered by Rabbit 2.2.2
REXML - Future1
未来1
Introduce
NodeSetNodeSetが足りないんじゃないか
My way with Ruby Powered by Rabbit 2.2.2
REXML - NodeSet
doc.
search("//list"). # => NodeSet
search("item"). # => All <item> in <list>
text # All texts in <item> in <list>
My way with Ruby Powered by Rabbit 2.2.2
REXML - Future2
未来2
Support
CSS SelectorsCSSセレクターが足りないんじゃないか
My way with Ruby Powered by Rabbit 2.2.2
REXML - CSS Selectors
CSSセレクター
doc.css_select("ul li, dl dt")
My way with Ruby Powered by Rabbit 2.2.2
REXML - Future3
未来3
Support
HTML5 supportHTML5対応が足りないんじゃないか
My way with Ruby Powered by Rabbit 2.2.2
REXML - HTML5
doc = REXML::HTML5Document.new(html5)
doc.search("//li")
doc.css_select("ul li")
My way with Ruby Powered by Rabbit 2.2.2
REXML - Future
未来
Low priority in my activities
優先度は高くない
✓
Do you want to work with me?
一緒にやりたい人はいる?
✓
My way with Ruby Powered by Rabbit 2.2.2
Opening2
きっかけ1
Presentationプレゼンテーション
My way with Ruby Powered by Rabbit 2.2.2
Rabbit
Presentation tool
for RubyistRubyist用のプレゼンツール
My way with Ruby Powered by Rabbit 2.2.2
Rabbit - History
歴史
2004-07: The first release
最初のリリース
No other presentation tool for a
Rubyist even now
今でもRubyist用のプレゼンツールは他にない
✓
✓
2010: Matz migrated to Rabbit
まつもとさんがRabbitに乗り換えた
Since RubyKaigi 2010?
RubyKaigi 2010から?
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
For Rubyist?
Rubyist向けに必要なもの
RD supportRDサポート
My way with Ruby Powered by Rabbit 2.2.2
RD
Ruby Document
Designed by Matz (Right?)
まつもとさんがデザインしたはず
✓
✓
A text based markup language
テキストベースのマークアップ言語
Version controllable
バージョン管理できる
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
For Rubyist?
Rubyist向けに必要なもの
Publish
our slides
as usualいつも通りスライドを公開できる
My way with Ruby Powered by Rabbit 2.2.2
Publish as usual
いつも通り公開
% gem push your-slide-1.0.gem
My way with Ruby Powered by Rabbit 2.2.2
Published!
公開完了!
https://slide.rabbit-shocker.org/
My way with Ruby Powered by Rabbit 2.2.2
What's needed for
presentation tool?
プレゼンツールに必要なもの
GUI
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GTK3
Multi-platform
GUI toolkit複数プラットフォーム対応GUIツールキット
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GTK3 - History
歴史
1998-01: 1st release by Matz
[ruby-list:5877]
まつもとさんが最初のリリース
✓
2004-05: I joined development
私が開発に参加
✓
My way with Ruby Powered by Rabbit 2.2.2
Example - Window
require "gtk3"
app = Gtk::Application.new
app.signal_connect(:activate) do
window = Gtk::ApplicationWindow.new(app)
window.show_all
end
app.run
My way with Ruby Powered by Rabbit 2.2.2
Approaches on
missing libraries(1)
ライブラリーがない時のやり方(1)
Implement only the needed
features
必要な機能だけ実装
1.
then back to Rabbit
必要な機能ができたらRabbitに戻る
2.
My way with Ruby Powered by Rabbit 2.2.2
Approaches on
missing libraries(2)
ライブラリーがない時のやり方(2)
Implement not only the
needed features
必要な機能だけじゃなく
1.
but also almost all features
ほぼすべての機能を実装
2.
then back to Rabbit
終わったらRabbitに戻る
3.
My way with Ruby Powered by Rabbit 2.2.2
My approach
私のやり方
Implement
all featurestesting with Rabbit
すべての機能を実装
My way with Ruby Powered by Rabbit 2.2.2
My priority
私の優先度
Rabbit is important
Rabbitは大事だけど
✓
Increasing what Ruby can do
is important too
Rubyでできることを増やすのも大事
✓
My way with Ruby Powered by Rabbit 2.2.2
GTK+ 3 - Size
サイズ
3000 over APIs3000以上のAPI
My way with Ruby Powered by Rabbit 2.2.2
How to implement
実装方法
Handwriting手書き
↓
Auto generation自動生成
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GI
Generate bindings
automatically
at run-time実行時に自動でバインディングを生成
GI: GObject Introspection
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GI - History
歴史
2012: The first commit by me
最初のコミット
✓
2014: Ruby/GTK3 used Ruby/GI
Ruby/GTK3をRuby/GIベースに移行
✓
My way with Ruby Powered by Rabbit 2.2.2
Handwriting
手書き
Ruby
scriptRuby/GTK3
Handwritten bindings
libgtk-3
Ruby
C
My way with Ruby Powered by Rabbit 2.2.2
Auto generation
自動生成
Ruby
scriptRuby/GTK3
Generated at run-time
Gtk-3.0.typelib Ruby/GI
GI = GObject Introspection
libgtk-3
Ruby
C
Data
My way with Ruby Powered by Rabbit 2.2.2
Performance(性能)
Slower than handwriting
手書きより遅い
✓
Overhead
オーバーヘッド
Dynamic arguments conversion
動的な引数の変換
✓
libffi based function call
libffiを使った関数呼び出し
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Improve idea(改善案)
JIT compilingJITコンパイル
My way with Ruby Powered by Rabbit 2.2.2
JIT compiling(JITコンパイル)
VALUE rb_method_generic() {
func = dlsym(name); ...
ffi_call(func, ..., &result);
return C2RB(result);
} ↓
// Build rb_method() at run-time and call it.
VALUE rb_method() {return C2RB(name(...));}
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GI - See also
参考情報
"How to create bindings
2016" at RubyKaigi 2016
http://rubykaigi.org/2016/presentations/ktou.html✓
✓
"GI Introduction" (in Japanese)
「GObject Introspection入門」
https://github.com/RubyData/workshop-materials/
blob/master/gobject-introspection/introduction.md
✓
Build system: Meson + Ninja
ビルドシステム:Meson + Ninja
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GI based bindings
Ruby/GIベースのバインディング
Ruby/Pango
My way with Ruby Powered by Rabbit 2.2.2
Ruby/Pango
Text layout engine
with
i18n support国際化対応のテキストレイアウトエンジン
i18n: Internationalization
My way with Ruby Powered by Rabbit 2.2.2
Prohibition processing
禁則処理
widget.signal_connect(:draw) do |_, context|
layout = context.create_pango_layout
layout.text = "Helloこんにちは。 "
context.show_pango_layout(layout)
GLib::Source::CONTINUE
end
My way with Ruby Powered by Rabbit 2.2.2
Bidirectional text
双方向テキスト
Hello
‫م‬‫ر‬‫ح‬‫ب‬‫ا‬
こんにちは
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GI based bindings
Ruby/GIベースのバインディング
Ruby/GdkPixbuf2
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GdkPixbuf2
Image
manipulation画像操作
My way with Ruby Powered by Rabbit 2.2.2
Half image
画像を半分に
require "gdk_pixbuf2"
# Load an image: Format is auto detected
pixbuf = GdkPixbuf::Pixbuf.new(file: "x.png")
# Scale to half size
half = pixbuf.scale(pixbuf.width / 2,
pixbuf.height / 2,
:bilinear)
# Save as different format
half.save("half.jpg")
My way with Ruby Powered by Rabbit 2.2.2
Animated GIF
アニメーションGIF
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GI based bindings
Ruby/GIベースのバインディング
Ruby/Poppler
My way with Ruby Powered by Rabbit 2.2.2
Ruby/Poppler
PDF
parser/rendererPDFパーサー・レンダラー
My way with Ruby Powered by Rabbit 2.2.2
Text extraction
テキスト抽出
require "poppler"
doc = Poppler::Document.new("x.pdf")
doc.each do |page|
puts(page.text) # Extract all texts
end
My way with Ruby Powered by Rabbit 2.2.2
Embed PDF
PDFの埋め込み
Improve extension API - C++ as better language for extension Powered by Rabbit 2.2.2
Improve extension API
C++ as better language for extension
Kouhei Sutou
ClearCode Inc.
RubyKaigi 2017
2017-09-18
http://rubykaigi.org/2017/presentations/ktou.html
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GI based bindings
Ruby/GIベースのバインディング
Ruby/GStreamer
My way with Ruby Powered by Rabbit 2.2.2
Ruby/GStreamer
Audio/Video player音声・動画プレイヤー
(*) Streaming media framework
本当はストリーミングメディアフレームワーク
My way with Ruby Powered by Rabbit 2.2.2
Camera(カメラ)
require "gst"
description = [
"autovideosrc", # Camera
"videoconvert", # Filter
"autovideosink", # Window
].join(" ! ")
pipeline = Gst.parse_launch(description)
pipeline.play
until pipeline.bus.poll.type.eos? do
end # Main loop
pipeline.stop
My way with Ruby Powered by Rabbit 2.2.2
Face detection(顔認識)
description = [
"autovideosrc", # Camera
"videoconvert", # Filter
"facedetect", # Face detection (!)
"videoconvert", # Filter (!)
"autovideosink", # Window
].join(" ! ")
pipeline = Gst.parse_launch(description)
pipeline.play
My way with Ruby Powered by Rabbit 2.2.2
What's needed for
presentation tool?
プレゼンツールに必要なもの
PDF outputPDF出力
My way with Ruby Powered by Rabbit 2.2.2
rcairo
2D graphics
renderer2次元画像レンダラー
My way with Ruby Powered by Rabbit 2.2.2
rcairo - Outputs
出力
PNG・SVG✓
PDF✓
Display (X/macOS/Windows)✓
...✓
My way with Ruby Powered by Rabbit 2.2.2
rcairo - History
歴史
2003-10: The initial commit
最初のコミット
✓
2005-09: I started developing
私が開発に参加
✓
My way with Ruby Powered by Rabbit 2.2.2
Red A4 PDF
赤いA4のPDFを出力
require "cairo"
include Cairo
PDFSurface.create("x.pdf", "A4") do |surface|
Context.create(surface) do |context|
context.set_source_color(:red)
context.paint
end
end
My way with Ruby Powered by Rabbit 2.2.2
rcairo - GC
11
11.5
12
12.5
13
13.5
14
14.5
15
0 100 200 300 400 500 600 700 800 900 1000
Memoryusage(MiB)
Nth loop
1000.times do
Cairo::ImageSurface.new(:argb32, 6000, 6000)
end
My way with Ruby Powered by Rabbit 2.2.2
GC - Cause(原因)
11
11.5
12
12.5
13
13.5
14
14.5
15
0 100 200 300 400 500 600 700 800 900 1000
Memoryusage(MiB)
Nth loop
GC isn't run often enough
GCの実行頻度が十分じゃなかった
Because Ruby doesn't know how
much memory used by cairo
Rubyはcairoのメモリー使用量を知らないから
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
GC - Fix(修正)
11
11.5
12
12.5
13
13.5
14
14.5
15
0 100 200 300 400 500 600 700 800 900 1000
Memoryusage(MiB)
Nth loop
rb_gc_adjust_memory_usage()
Improve GC frequency(GC実行頻度を改善)✓
✓
Ruby 2.4 ships it(Ruby 2.4以降)✓
My way with Ruby Powered by Rabbit 2.2.2
What's needed for
presentation tool?
プレゼンツールに必要なもの
Easy to install簡単インストール
My way with Ruby Powered by Rabbit 2.2.2
native-package-installer
Install
system packages
on gem install
gem install時にシステムのパッケージをインストール
My way with Ruby Powered by Rabbit 2.2.2
extconf.rb/Rakefile
require "pkg-config"
require "native-package-installer"
unless PKGConfig.check_version?("gdk-3.0")
packages = {
altlinux: "libgtk+3-devel",
debian: "libgtk-3-dev",
redhat: "pkgconfig(gdk-3.0)",
homebrew: "gtk+3",
macports: "gtk3",
msys2: "gtk3",
}
unless NativePackageInstaller.install(packages)
exit(false)
end
end
My way with Ruby Powered by Rabbit 2.2.2
rake-compiler
Build fat gem
by
cross compileクロスコンパイルでfat gemをビルド
My way with Ruby Powered by Rabbit 2.2.2
rake-compiler - History
歴史
2008-11: The first commit
最初のコミット
✓
2014-12: Orphan
だれかメンテナー変わってー
✓
2014-12:
I became the maintainer
私がメンテナーになった
✓
My way with Ruby Powered by Rabbit 2.2.2
Opening3
きっかけ3
Testテスト
My way with Ruby Powered by Rabbit 2.2.2
test-unit
Testing
framework
to write tests
in RubyRubyでテストを書けるテスティングフレームワーク
My way with Ruby Powered by Rabbit 2.2.2
test-unit - History
歴史
2003-02: Import to Ruby
Rubyに取り込まれる
✓
2008-05:
I became the maintainer
私がメンテナーになった
✓
2008-10: Removed from Ruby
Rubyから削除
✓
See also: "The history of testing framework in Ruby"
http://rubykaigi.org/2015/presentations/kou
My way with Ruby Powered by Rabbit 2.2.2
test-unit - New feature
新機能
Groupingグループ化
My way with Ruby Powered by Rabbit 2.2.2
Grouping
グループ化
The most important feature
一番大事な機能
✓
Keep tests maintainable
メンテナンスできるテストを維持できる
✓
My way with Ruby Powered by Rabbit 2.2.2
Example(例)
class StackTest < Test::Unit::TestCase
class PushTest < self
def test_XXX; end
end
class PopTest < self
def test_XXX; end
end
end
My way with Ruby Powered by Rabbit 2.2.2
Method style(メソッド形式)
class StackTest < Test::Unit::TestCase
sub_test_case("#push") do
def test_XXX; end
end
sub_test_case("#pop") do
def test_XXX; end
end
end
My way with Ruby Powered by Rabbit 2.2.2
test-unit - New feature
新機能
Data driven
testデータ駆動テスト
My way with Ruby Powered by Rabbit 2.2.2
Data driven test
データ駆動テスト
data("positive", [3, 1, 2])
data("negative", [-4, 1, -5])
def test_add(data)
expected, augend, addend = data
assert_equal(expected,
add(augend, addend))
end
My way with Ruby Powered by Rabbit 2.2.2
test-unit - New feature
新機能
Reverse
backtrace逆順のバックトレース
My way with Ruby Powered by Rabbit 2.2.2
Reverse backtrace
逆順のバックトレース
Reverse backtrace only for
terminal output
ターミナル出力のときだけ逆順
✓
The same change as Ruby 2.5.0
Ruby 2.5.0と同じ変更
✓
My way with Ruby Powered by Rabbit 2.2.2
test-unit - New feature
新機能
Test doubleテストダブル
My way with Ruby Powered by Rabbit 2.2.2
test-unit-rr
RR integrationRRとの統合
My way with Ruby Powered by Rabbit 2.2.2
RR - History
歴史
2007-06: The initial commit
最初のコミット
✓
2014-12: Orphan
だれかメンテナー変わってー
✓
2015-05:
I became the maintainer
私がメンテナーになった
✓
My way with Ruby Powered by Rabbit 2.2.2
Stub(スタブ)
adder = Object.new
adder.add(1, 2) # => Error
stub(adder).add(1, 2) {3}
adder.add(1, 2) # => 3
My way with Ruby Powered by Rabbit 2.2.2
Opening4
きっかけ4
Full text
search全文検索
My way with Ruby Powered by Rabbit 2.2.2
Rroonga
Full text
search
library全文検索ライブラリー
My way with Ruby Powered by Rabbit 2.2.2
Library vs Client
ライブラリー対クライアント
No server process
サーバープロセスがいらない
✓
Easy to start
簡単に使い始められる
✓
Write in Ruby
Rubyで書ける
✓
My way with Ruby Powered by Rabbit 2.2.2
Create DB(データベース作成)
require "groonga"
Groonga::Database.create(path: "/tmp/db")
My way with Ruby Powered by Rabbit 2.2.2
Define schema(スキーマ定義)
Groonga::Schema.define do |schema|
schema.create_table("docs") do |table|
# The column to store text
table.text("content")
end
# The index for full text search
schema.create_lexicon("terms") do |table|
table.index("docs.content")
end
end
My way with Ruby Powered by Rabbit 2.2.2
Add records(レコード追加)
docs = Groonga["docs"]
docs.add(content: "String#<< concatenates ...")
docs.add(content: "String#dup duplicates ...")
My way with Ruby Powered by Rabbit 2.2.2
Search(検索)
matches = docs.select do |record|
record.content.match("concat")
end
p matches.size # => 1
matches.each do |record|
p record.content # => "String#<< concat..."
end
My way with Ruby Powered by Rabbit 2.2.2
User - Rabbit Slide Show
https://slide.rabbit-shocker.org/
My way with Ruby Powered by Rabbit 2.2.2
User - Rurema Search
https://docs.ruby-lang.org/ja/search/
My way with Ruby Powered by Rabbit 2.2.2
Rurema Search
るりまサーチ
Super fast!
すごく速い!
✓
Tuned for Ruby documents
Rubyのドキュメント用にチューニング
✓
My way with Ruby Powered by Rabbit 2.2.2
User - RDoc Search
Planning
考えてはいるけど。。。
✓
Do you want to work with me?
一緒にやりたい人はいる?
✓
My way with Ruby Powered by Rabbit 2.2.2
Rurema and RDoc
Project Language Target
Rurema Japanese Japanese
Rubyists
RDoc English All
Rubyists
My way with Ruby Powered by Rabbit 2.2.2
Source
ソース
Shared nothing
共有していない
Copy based share
共有するときはコピー
✓
e.g.:
Description,
Sample codes,
...
例:説明やサンプルコードなどをコピー
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
From my point of view
私が思うこと
Can we share documents?
ドキュメントを共有できないかな
✓
How to work together deeply?
もっと協力してできないかな
✓
My way with Ruby Powered by Rabbit 2.2.2
I18n
国際化
Source: RDoc
ソースはRDoc
For all Rubyists
これは全Rubyist向け
✓
✓
Translate to Japanese
RDocのドキュメントを日本語に翻訳
For Japanese Rubyists
これは日本人Rubyist向け
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Add i18n support
国際化サポートを追加
YARD
Since 0.8.0 at 2012-04✓
✓
RDoc
Since 4.2.0 at 2014-12✓
✓
My way with Ruby Powered by Rabbit 2.2.2
YARD - i18n
# Generates po/yard.pot
# po/yard.potを生成
% yard i18n
My way with Ruby Powered by Rabbit 2.2.2
YARD - i18n
# Create po/ja.po from po/yard.pot
# po/yard.potからpo/ja.poを作成
% msginit 
--locale=ja_JP.UTF-8 
--input=po/yard.pot 
--output-file=po/ja.po
My way with Ruby Powered by Rabbit 2.2.2
YARD - i18n
# Translate messages in po/ja.po
# po/ja.po内のメッセージを翻訳
% editor po/ja.po
My way with Ruby Powered by Rabbit 2.2.2
YARD - i18n
# Generate documents with
# translated messages
# 翻訳したメッセージを使って
# ドキュメント生成
% yard --locale ja
My way with Ruby Powered by Rabbit 2.2.2
Packnga
Rake task
for
YARD i18nYARDの国際化機能向けのRakeタスク
My way with Ruby Powered by Rabbit 2.2.2
Setting
設定
# Rakefile
require "packnga"
Packnga::DocumentTask.new(spec) do |task|
task.original_language = "en"
task.translate_languages = ["ja"]
end
My way with Ruby Powered by Rabbit 2.2.2
Workflow
ワークフロー
% rake reference:translate
% editor doc/po/ja/x.edit.po
% rake reference:translate
% editor lib/x.rb
% rake reference:translate
...
My way with Ruby Powered by Rabbit 2.2.2
Users
ユーザー
test-unit✓
Rroonga✓
...✓
My way with Ruby Powered by Rabbit 2.2.2
RDoc - i18n
# Generates doc/rdoc.pot
# doc/rdoc.potを生成
% rdoc --format=pot
My way with Ruby Powered by Rabbit 2.2.2
RDoc - i18n
# Create locale/ja.po
# from doc/rdoc.pot
# doc/rdoc.potからlocale/ja.poを作成
% mkdir -p locale
% msginit 
--locale=ja_JP.UTF-8 
--input=doc/rdoc.pot 
--output-file=locale/ja.po
My way with Ruby Powered by Rabbit 2.2.2
RDoc - i18n
# Translate messages in locale/ja.po
# locale/ja.po内のメッセージを翻訳
% editor locale/ja.po
My way with Ruby Powered by Rabbit 2.2.2
RDoc - i18n
# Generate documents with
# translated messages
# 翻訳したメッセージを使って
# ドキュメント生成
% rdoc --locale ja
My way with Ruby Powered by Rabbit 2.2.2
RDoc, Rurema and i18n
No progress...
ツールの整備まででそれ以降は進んでいない。。。
✓
Do you want to work with me?
一緒にやりたい人はいる?
✓
My way with Ruby Powered by Rabbit 2.2.2
jekyll-task-i18n
Jekyll + i18n
My way with Ruby Powered by Rabbit 2.2.2
Features
機能
Support all markups!
すべてのマークアップ対応!
✓
GitHub Pages ready!
GitHub Pagesでも使える!
✓
My way with Ruby Powered by Rabbit 2.2.2
Setting(設定)
# Rakefile
require "jekyll/task/i18n"
Jekyll::Task::I18n.define do |task|
task.locales = ["ja"]
task.files = Rake::FileList["**/*.md"]
task.files -= Rake::FileList["_*/**/*.md"]
task.locales.each do |locale|
task.files -= Rake::FileList["#{locale}/**/*.md"]
end
end
task default: ["jekyll:i18n:translate"]
My way with Ruby Powered by Rabbit 2.2.2
Workflow(ワークフロー)
% editor index.md
% rake
% editor _po/ja/index.edit.po
% rake
% git commit -a
My way with Ruby Powered by Rabbit 2.2.2
User - Red Data Tools
https://red-data-tools.github.io/
My way with Ruby Powered by Rabbit 2.2.2
groonga-client
Full text
search
client全文検索クライアント
My way with Ruby Powered by Rabbit 2.2.2
Library vs Client
ライブラリー対クライアント
Less dependencies
依存関係が少ない
✓
Less resources needed
必要なリソースが少ない
✓
My way with Ruby Powered by Rabbit 2.2.2
Search(検索)
require "groonga/client"
url = "http://localhost:10041"
Groonga::Client.open(url: url) do |client|
response =
client.select(table: "docs",
match_columns: "content",
query: "concat")
p response.n_hits # => 1
end
My way with Ruby Powered by Rabbit 2.2.2
Asynchronous(非同期)
# Call with block
client.select(table: "docs",
match_columns: "content",
query: "concat") do |response|
p response.n_hits # => 1
end
p :here # => :here then ↑
sleep(0.1)
My way with Ruby Powered by Rabbit 2.2.2
Asynchronous - wait
request =
client.select(table: "docs",
match_columns: "content",
query: "concat") do |response|
p response.n_hits # => 1
end
p :here # => :here then ↑
request.wait
My way with Ruby Powered by Rabbit 2.2.2
groonga-client-rails
Ruby on Rails
integration
for
groonga-clientRuby on Railsで使う
My way with Ruby Powered by Rabbit 2.2.2
Architecture
アーキテクチャー
Data: RDBMS
データはRDBMSに格納
✓
Full text search: Groonga
全文検索はGroongaで処理
✓
My way with Ruby Powered by Rabbit 2.2.2
Define app searcher
アプリ用サーチャーを定義
# app/searchers/application_searcher.rb
class ApplicationSearcher <
Groonga::Client::Searcher
end
My way with Ruby Powered by Rabbit 2.2.2
Define searcher
サーチャーを定義
# app/searchers/document_searcher.rb
class DocumentsSearcher < ApplicationSearcher
# Define a full text search index as "content"
# 全文検索用のインデックスを定義
schema.column :content, {
type: "Text",
index: true,
index_type: :full_text_search,
}
end
My way with Ruby Powered by Rabbit 2.2.2
Bind to model
モデルと結びつける
# app/models/document.rb
class Document < ApplicationRecord
# DocumentsSearcher searches Document model
source = DocumentsSearcher.source(self)
# Bind Document's "content" column to
# DocumentsSearcher's "content" index
source.content = :content
end
My way with Ruby Powered by Rabbit 2.2.2
Search(検索)
# app/controllers/documents_controller.rb
class DocumentsController < ApplicationController
def index
@query = params[:query]
searcher = DocumentSearcher.new
@result_set = searcher.search.
query(@query).
result_set
end
end
My way with Ruby Powered by Rabbit 2.2.2
See also
参考情報
Tutorial in Japanese
日本語のチュートリアル
http://www.clear-code.com/blog/2016/12/22.html✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Ranguba (WIP)(開発中)
Full text
search system全文検索システム
My way with Ruby Powered by Rabbit 2.2.2
Use cases
利用例
File server search
ファイルサーバー検索
✓
E-mail search
メール検索
✓
Web site search
Webサイト検索
✓
My way with Ruby Powered by Rabbit 2.2.2
Features
機能
Crawlers
クローラー
✓
Web UI✓
Command line interface
Update documents
更新
✓
Search documents
検索
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
ChupaText
Text extractorテキスト抽出
My way with Ruby Powered by Rabbit 2.2.2
Supported formats
対応フォーマット
PDF✓
Office documents(オフィス文書)
OpenDocument, Word, Excel, ...✓
✓
E-mail(メール)✓
...✓
My way with Ruby Powered by Rabbit 2.2.2
Interface
インターフェイス
HTTP✓
Web UI✓
Command line interface✓
API (Library)✓
My way with Ruby Powered by Rabbit 2.2.2
Install - Docker
% GITHUB=https://github.com
% git clone 
${GITHUB}/ranguba/chupa-text-docker.git
% cd chupa-text-docker
% docker-compose up --build
My way with Ruby Powered by Rabbit 2.2.2
How to use
使い方
% curl 
--form data=@XXX.pdf 
http://localhost:20080/extraction.json
My way with Ruby Powered by Rabbit 2.2.2
Use cases
利用例
Ranguba
Full text search system
全文検索システム
✓
✓
Commit e-mail
コミットメール
✓
My way with Ruby Powered by Rabbit 2.2.2
git-commit-mailer
Commit e-mail
for GitGit用のコミットメール
My way with Ruby Powered by Rabbit 2.2.2
Features
機能
HTML mail
HTMLメール
Highlighted diff
diffをハイライト
✓
✓
GitLab/GitHub Web hook
GitLab/GitHubのWebフック対応
By GitHub:clear-code/github-web-hooks-receiver✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Users
利用者
tDiary✓
My products✓
My way with Ruby Powered by Rabbit 2.2.2
commit-email.info
Commit e-mail
as a
Serviceコミットメールのクラウドサービス
My way with Ruby Powered by Rabbit 2.2.2
How to use
使い方
Send a pull request to
GitHub:kou/commit-email.info
pull requestを送る
✓
Register a Web hook
Webフックを登録
✓
Subscribe your mailing list
メーリングリストを購読
✓
See also http://www.commit-email.info/
My way with Ruby Powered by Rabbit 2.2.2
Opening5
きっかけ5
Data processingデータ処理
My way with Ruby Powered by Rabbit 2.2.2
csv
CSV parserCSVパーサー
My way with Ruby Powered by Rabbit 2.2.2
csv - History
歴史
2003: Import
Rubyに取り込み
✓
2007: Replaced with FasterCSV
FasterCSVで置き換え
✓
2018: I became a co-
maintainer with mrkn
mrknと一緒にメンテナーになった
✓
My way with Ruby Powered by Rabbit 2.2.2
Why?
なんで?
There are many data sources
in CSV
CSVのデータはたくさんある
✓
Important to process data
データを処理するためにCSVパーサーは重要
✓
My way with Ruby Powered by Rabbit 2.2.2
CSV format problems
CSVフォーマットの問題
Slow to parse
パースが遅い
✓
Too wild
なんでもあり
✓
My way with Ruby Powered by Rabbit 2.2.2
Red Arrow
Apache Arrow
Ruby
My way with Ruby Powered by Rabbit 2.2.2
Red Arrow - History
歴史
2017-02: The first commit
最初のコミット
✓
2018-05: Became the
"official" Ruby bindings of
Apache Arrow
Apache Arrowの公式Rubyバインディングになった
✓
My way with Ruby Powered by Rabbit 2.2.2
Apache Arrow
Super fast data format
すごく速いデータフォーマット
For in-memory data
インメモリーデータ用
✓
✓
Cross-language support
いろんな言語がサポート
Easy to share data with Python,
Java, ...
PythonやJavaなどとデータ交換がしやすい
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Performance(性能)
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
0.045
0 500 1000 1500 2000 2500
Loadtime(sec)
N rows
CSV Apache Arrow
My way with Ruby Powered by Rabbit 2.2.2
Apache Arrow - Position
立ち位置
A very important piece
in recent data processing
最近のデータ処理界隈ではすごく大事な1ピース
Like JIT for Ruby 3
Ruby 3で例えるとJITみたいな感じ
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Red Arrow - Impl.
実装
Based on Ruby/GI
Ruby/GIを使っている
Auto generated bindings
バインディングを自動生成
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Extendable load API
拡張可能なロードAPI
# Load Apache Arrow data
Arrow::Table.load("iris.arrow")
# Load CSV data
Arrow::Table.load("iris.csv")
# Load Apache Parquet data
Arrow::Table.load("iris.parquet")
My way with Ruby Powered by Rabbit 2.2.2
Apache Parquet
Super fast data format
すごく速いデータフォーマット
For storing analysis target data
解析対象のデータを保存する用
✓
✓
Widely used
広く使われている
✓
My way with Ruby Powered by Rabbit 2.2.2
Performance(性能)
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
0.045
0 500 1000 1500 2000 2500
Loadtime(sec)
N rows
CSV Apache Arrow Apache Parquet
My way with Ruby Powered by Rabbit 2.2.2
Red Parquet
Apache Parquet
My way with Ruby Powered by Rabbit 2.2.2
Red Data Tools
A project to
make Ruby data
processableRubyでデータ処理できるようにするためのプロジェクト
My way with Ruby Powered by Rabbit 2.2.2
Red Data Tools - History
歴史
2017-02: Start(開始)✓
2017-11-: Develop events per
month at Tokyo
東京で毎月開発イベントを開催
✓
My way with Ruby Powered by Rabbit 2.2.2
The number of products
プロダクト数
About 20including Red Arrow and Red Parquet
20くらい
Red ArrowやRed ParquetもRed Data Toolsプロダクツ
My way with Ruby Powered by Rabbit 2.2.2
Red Datasets
Dataset fetcherデータセット取得
My way with Ruby Powered by Rabbit 2.2.2
Supported datasets
対応データセット
Iris✓
CIFAR✓
Wikipedia✓
My way with Ruby Powered by Rabbit 2.2.2
Wikipedia
require "datasets"
wikipedia = Datasets::Wikipedia.new
wikipedia.each do |page|
p page.title
end
My way with Ruby Powered by Rabbit 2.2.2
Wikipedia search
pages = Groonga["pages"]
wikipedia = Datasets::Wikipedia.new
wikipedia.each do |page|
pages.add(title: page.title,
content: page.revision.text)
end
ruby_pages = pages.select do |record|
record.match("Ruby OR Rails") do |target|
(target.title * 10) | target.content
end
end
p ruby_pages.size
My way with Ruby Powered by Rabbit 2.2.2
jekyll-jupyter-notebook
Jekyll
+
Jupyter
Notebook
My way with Ruby Powered by Rabbit 2.2.2
Usage
使い方
{% jupyter_notebook sample.ipynb %}
My way with Ruby Powered by Rabbit 2.2.2
Red OpenCV
Computer visionコンピュータービジョン
My way with Ruby Powered by Rabbit 2.2.2
Camera(カメラ)
require "cv"
camera = CV::Camera.new
image = camera.read
image.write("capture.jpg")
My way with Ruby Powered by Rabbit 2.2.2
Face detect(顔認識)
image_gray = image.convert_color(:bgr2gray)
classifier = # Face detector
CV::CascadeClassifier.new("frontalface_alt")
objects = classifier.detect(image_gray)
color = CV::Color.new(0, 0, 255)
objects.each do |object|
# Draw detected area
image.draw_rectangle(object, color)
end
image.write("detect.jpg")
My way with Ruby Powered by Rabbit 2.2.2
Red OpenCV - Impl.
実装
Based on Ruby/GI
Ruby/GIを使っている
Auto generated bindings
バインディングを自動生成
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Ad: RubyData Workshop
2018-06-01 15:50/17:20✓
Contents:(内容)
Workshop by mrkn
mrknによるワークショップ
✓
Presentations from
Red Data Tools members
Red Data ToolsメンバーによるRed Data Toolsでやって
きたことの紹介
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
Process data with Ruby
Rubyでデータ処理
We're working on it
Red Data Toolsは継続して取り組んでいる
✓
Do you want to work with us?
一緒にやりたい人はいる?
✓
My way with Ruby Powered by Rabbit 2.2.2
How to join1(参加方法1)
Join our chat rooms:
チャットルームに参加
en: Gitter:red-data-tools/en✓
ja: Gitter:red-data-tools/ja✓
✓
Join monthly events at Tokyo
東京での毎月の開発イベントに参加
https://speee.connpass.com/✓
✓
My way with Ruby Powered by Rabbit 2.2.2
How to join2(参加方法2)
Hire developers to work on it
仕事として開発する開発者を雇う
e.g.: mrkn by Speee, Inc.
例:Speeeの村田さん
✓
✓
My way with Ruby Powered by Rabbit 2.2.2
How to join3(参加方法3)
Order ClearCode to work on it
クリアコードに開発の仕事を発注
✓
Join ClearCode to work on it
クリアコードに入って仕事として開発を進める
✓
My way with Ruby Powered by Rabbit 2.2.2
Wrap up
まとめ
I'm working on the following
as a Rubyist
Rubyistとしての私の活動
Increase what Ruby can do
with free software
フリーソフトウェアを使ってRubyでできることを増やす
✓
Maintain libraries
ライブラリーのメンテナス
✓
✓
Do you want to work with me?
一緒にやりたい人はいる?
✓

More Related Content

Similar to My way with Ruby

Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012rengelbrecht
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyHiroshi SHIBATA
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
 
A rough guide to JavaScript Performance
A rough guide to JavaScript PerformanceA rough guide to JavaScript Performance
A rough guide to JavaScript Performanceallmarkedup
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?Hiroshi SHIBATA
 
O que tem de novo no Ruby 2.0?
O que tem de novo no Ruby 2.0?O que tem de novo no Ruby 2.0?
O que tem de novo no Ruby 2.0?Fabio Akita
 
Rationalを最適化してみた
Rationalを最適化してみたRationalを最適化してみた
Rationalを最適化してみたTadashi Saito
 
Merb presentation at ORUG
Merb presentation at ORUGMerb presentation at ORUG
Merb presentation at ORUGMatt Aimonetti
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems nhm taveer hossain khan
 
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)Hung Wu Lo
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executablesJeremy Hinegardner
 
Your fist RubyMotion Application
Your fist RubyMotion ApplicationYour fist RubyMotion Application
Your fist RubyMotion Applicationtoamitkumar
 
Ruby on Docker
Ruby on DockerRuby on Docker
Ruby on Dockerjasnow
 

Similar to My way with Ruby (20)

Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012
 
Web application intro
Web application introWeb application intro
Web application intro
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
Cucumber
CucumberCucumber
Cucumber
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
A rough guide to JavaScript Performance
A rough guide to JavaScript PerformanceA rough guide to JavaScript Performance
A rough guide to JavaScript Performance
 
5 random ruby tips
5 random ruby tips5 random ruby tips
5 random ruby tips
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
O que tem de novo no Ruby 2.0?
O que tem de novo no Ruby 2.0?O que tem de novo no Ruby 2.0?
O que tem de novo no Ruby 2.0?
 
Rationalを最適化してみた
Rationalを最適化してみたRationalを最適化してみた
Rationalを最適化してみた
 
Merb presentation at ORUG
Merb presentation at ORUGMerb presentation at ORUG
Merb presentation at ORUG
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems
 
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executables
 
Your fist RubyMotion Application
Your fist RubyMotion ApplicationYour fist RubyMotion Application
Your fist RubyMotion Application
 
Ruby on Docker
Ruby on DockerRuby on Docker
Ruby on Docker
 
IJTC%202009%20JRuby
IJTC%202009%20JRubyIJTC%202009%20JRuby
IJTC%202009%20JRuby
 
IJTC%202009%20JRuby
IJTC%202009%20JRubyIJTC%202009%20JRuby
IJTC%202009%20JRuby
 

More from Kouhei Sutou

RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowRubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowKouhei Sutou
 
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Kouhei Sutou
 
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowRubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowKouhei Sutou
 
Rubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアRubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアKouhei Sutou
 
Apache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかApache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかKouhei Sutou
 
Apache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataApache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataKouhei Sutou
 
Redmine検索の未来像
Redmine検索の未来像Redmine検索の未来像
Redmine検索の未来像Kouhei Sutou
 
Apache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataApache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataKouhei Sutou
 
Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Kouhei Sutou
 
Apache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームApache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームKouhei Sutou
 
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムMySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムKouhei Sutou
 
MySQL 8.0でMroonga
MySQL 8.0でMroongaMySQL 8.0でMroonga
MySQL 8.0でMroongaKouhei Sutou
 
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Kouhei Sutou
 
MariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムMariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムKouhei Sutou
 
PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!Kouhei Sutou
 
PGroonga 2 - PostgreSQLでの全文検索の決定版
PGroonga 2 - PostgreSQLでの全文検索の決定版PGroonga 2 - PostgreSQLでの全文検索の決定版
PGroonga 2 - PostgreSQLでの全文検索の決定版Kouhei Sutou
 

More from Kouhei Sutou (20)

RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowRubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
 
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
 
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowRubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
 
Rubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアRubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェア
 
Apache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかApache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのか
 
Apache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataApache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory data
 
Apache Arrow 2019
Apache Arrow 2019Apache Arrow 2019
Apache Arrow 2019
 
Redmine検索の未来像
Redmine検索の未来像Redmine検索の未来像
Redmine検索の未来像
 
Apache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataApache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory data
 
Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6
 
Apache Arrow
Apache ArrowApache Arrow
Apache Arrow
 
Apache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームApache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォーム
 
Apache Arrow
Apache ArrowApache Arrow
Apache Arrow
 
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムMySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
 
MySQL 8.0でMroonga
MySQL 8.0でMroongaMySQL 8.0でMroonga
MySQL 8.0でMroonga
 
Red Data Tools
Red Data ToolsRed Data Tools
Red Data Tools
 
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
 
MariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムMariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システム
 
PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!
 
PGroonga 2 - PostgreSQLでの全文検索の決定版
PGroonga 2 - PostgreSQLでの全文検索の決定版PGroonga 2 - PostgreSQLでの全文検索の決定版
PGroonga 2 - PostgreSQLでの全文検索の決定版
 

Recently uploaded

A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxatharvdev2010
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Transport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MITransport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MIRomil Mishra
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Automation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementAutomation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementDianaGray10
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...stockholm university
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Introduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptxIntroduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptxmprakaash5
 
Dynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientationDynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientationBuild Intuit
 
The Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data EcosystemThe Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data EcosystemSafe Software
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Why Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile EvolutionWhy Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile EvolutionDEEPRAJ PATHAK
 

Recently uploaded (20)

A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptx
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Transport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MITransport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MI
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Automation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementAutomation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions management
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Introduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptxIntroduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptx
 
Dynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientationDynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientation
 
The Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data EcosystemThe Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data Ecosystem
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Why Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile EvolutionWhy Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile Evolution
 

My way with Ruby

  • 1. My way with Ruby Powered by Rabbit 2.2.2 My way with Ruby Kouhei Sutou ClearCode Inc. RubyKaigi 2018 2018-06-01
  • 2. My way with Ruby Powered by Rabbit 2.2.2 Ad: Silver sponsor
  • 3. My way with Ruby Powered by Rabbit 2.2.2 Acknowledgment 感謝 @drbrain Eric Hodel He fixed English in this slide 英語をチェックしてくれたよ!ありがとう!
  • 4. My way with Ruby Powered by Rabbit 2.2.2 Keynote-ish topic キーノートっぽい話題 Did you think about it?考えたことある?
  • 5. My way with Ruby Powered by Rabbit 2.2.2 Keynote-ish topic1 キーノートっぽい話題1 Future未来のこと
  • 6. My way with Ruby Powered by Rabbit 2.2.2 Keynote-ish topic2 キーノートっぽい話題2 Focus on one thing deeplyなにかを深掘り
  • 7. My way with Ruby Powered by Rabbit 2.2.2 Keynote-ish topic3 キーノートっぽい話題3 Overview俯瞰した話
  • 8. My way with Ruby Powered by Rabbit 2.2.2 My activities as a Rubyist 私のRubyist活動 Increase what Ruby can do with free software フリーソフトウェアを使ってRubyでできることを増やす ✓ Maintain libraries ライブラリーのメンテナンス ✓
  • 9. My way with Ruby Powered by Rabbit 2.2.2 # of libraries maintained メンテナンスしているライブラリー数 About 130130くらい
  • 10. My way with Ruby Powered by Rabbit 2.2.2 Today's topic 今日の話題 Overview what we can do with RubyRubyでできるようになったことをたくさん紹介
  • 11. My way with Ruby Powered by Rabbit 2.2.2 How to find targets? そんなにネタがあるの? Just I needed単に自分が必要だったから
  • 12. My way with Ruby Powered by Rabbit 2.2.2 Opening1 きっかけ1 Web feedWebフィード
  • 13. My way with Ruby Powered by Rabbit 2.2.2 RSS Parser RSS/Atom parser with validationバリデーション機能付きのRSS/Atomパーサー
  • 14. My way with Ruby Powered by Rabbit 2.2.2 RSS Parser - History 歴史 2003-05: The first release 最初のリリース No other RSS/Atom parser that supports validation even now 今でもバリデーション付きのパーサーは他にない ✓ ✓ 2004-01: Ruby bundles this RubyがRSS Parserをバンドル I became a Ruby committer Rubyコミッターになる ✓ ✓
  • 15. My way with Ruby Powered by Rabbit 2.2.2 Validate RSS/Atom RSS/Atomのバリデーション Important for me 私にとっては大事 ✓ Most wild RSS/Atom feeds are invalid 野生のRSS/Atomの多くは不正 Validation helps to find problems バリデーションがあると問題を見つけやすくなる ✓ ✓
  • 16. My way with Ruby Powered by Rabbit 2.2.2 RSS::Parser.parse # Validates by default # デフォルトでバリデーション RSS::Parser.parse(rss) # Validation can be disabled # 無効にできる RSS::Parser.parse(rss, false)
  • 17. My way with Ruby Powered by Rabbit 2.2.2 Since Ruby 2.6 Ruby 2.6以降 # Supports keyword argument # キーワード引数対応 parse(rss, validate: false)
  • 18. My way with Ruby Powered by Rabbit 2.2.2 REXML XML parser written in pure RubyRuby実装のXMLパーサー
  • 19. My way with Ruby Powered by Rabbit 2.2.2 REXML - History 歴史 2001: Started by Sean Russell Seanさんが開発を開始 Based on Electric XML (Java) Java実装のElectric XMLを参考に開発 ✓ REXML is "Ruby Electric XML" REXMLは「Ruby Electric XML」 ✓ ✓ 2003-01: Ruby bundles this RubyがREXMLをバンドル ✓
  • 20. My way with Ruby Powered by Rabbit 2.2.2 REXML - Side story おまけ話 Sean was "書運" in Kanji Seanさんには「書運」という漢字表記があった ✓ He was interested in Japan 日本好きだった "How to write your name in Kanji?" 「君の名前は漢字でどう書くの?」 ✓ ✓ We can connect with Ruby! RubyistはRubyをきっかけにつながれる! ✓
  • 21. My way with Ruby Powered by Rabbit 2.2.2 Ad: Code Party 宣伝:コード懇親会
  • 22. My way with Ruby Powered by Rabbit 2.2.2 Ad: Code Party 宣伝:コード懇親会 This is a challenge 実験的な企画 Ruby focus: to have fun Rubyは楽しさを大事にしている ✓ We have fun writing Ruby Rubyistは楽しくRubyを書いている ✓ We have fun together with writing Ruby at after party!? だったら懇親会で一緒にRubyを書くと楽しそう!? ✓
  • 23. My way with Ruby Powered by Rabbit 2.2.2 Ad: Code Party 宣伝:コード懇親会 Matz attends Code Party まつもとさんもコード懇親会に参加 ✓ Sponsored by Speee, Inc. Speeeさんがスポンサー ✓
  • 24. My way with Ruby Powered by Rabbit 2.2.2 REXML - Recent1 最近1 2010-08: RubyKaigi 2010 I became the maintainer 私がメンテナーになった ✓ Because RSS Parser uses it RSS Parserが使っているから ✓ ✓
  • 25. My way with Ruby Powered by Rabbit 2.2.2 REXML - Recent2 最近2 2016: element[attribute_name] Ruby 2.5 ships it Ruby 2.5以降で使える ✓ ✓
  • 26. My way with Ruby Powered by Rabbit 2.2.2 REXML - Recent3 最近3 2018: Fix XPath related bugs XPath関連のバグ修正 Ruby 2.6 ships it Ruby 2.6以降で使える ✓ ✓
  • 27. My way with Ruby Powered by Rabbit 2.2.2 REXML - Future? 未来はあるの? Pure Ruby is valuable Rubyだけで書かれていることには価値がある Easy to install インストールが簡単 ✓ JIT may improve performance NOTE: We should improve general logic before we expect JIT to improve performance JITで速くなるかもしれない JITの前に普通にロジックを改良するのが先だけどね ✓ ✓
  • 28. My way with Ruby Powered by Rabbit 2.2.2 Recent my works 最近の仕事 XML/HTML libraries for LuaJIT LuaJIT用のXML/HTMLライブラリー XMLua: https://clear-code.github.io/xmlua/ libxml2 based XML/HTML parser ✓ LuaCS: https://clear-code.github.io/luacs/ CSS Selectors→XPath converter ✓ ✓ Found what is lacking in REXML API REXMLのAPIに足りないものはなにか考えた ✓
  • 29. My way with Ruby Powered by Rabbit 2.2.2 REXML - Future1 未来1 Introduce NodeSetNodeSetが足りないんじゃないか
  • 30. My way with Ruby Powered by Rabbit 2.2.2 REXML - NodeSet doc. search("//list"). # => NodeSet search("item"). # => All <item> in <list> text # All texts in <item> in <list>
  • 31. My way with Ruby Powered by Rabbit 2.2.2 REXML - Future2 未来2 Support CSS SelectorsCSSセレクターが足りないんじゃないか
  • 32. My way with Ruby Powered by Rabbit 2.2.2 REXML - CSS Selectors CSSセレクター doc.css_select("ul li, dl dt")
  • 33. My way with Ruby Powered by Rabbit 2.2.2 REXML - Future3 未来3 Support HTML5 supportHTML5対応が足りないんじゃないか
  • 34. My way with Ruby Powered by Rabbit 2.2.2 REXML - HTML5 doc = REXML::HTML5Document.new(html5) doc.search("//li") doc.css_select("ul li")
  • 35. My way with Ruby Powered by Rabbit 2.2.2 REXML - Future 未来 Low priority in my activities 優先度は高くない ✓ Do you want to work with me? 一緒にやりたい人はいる? ✓
  • 36. My way with Ruby Powered by Rabbit 2.2.2 Opening2 きっかけ1 Presentationプレゼンテーション
  • 37. My way with Ruby Powered by Rabbit 2.2.2 Rabbit Presentation tool for RubyistRubyist用のプレゼンツール
  • 38. My way with Ruby Powered by Rabbit 2.2.2 Rabbit - History 歴史 2004-07: The first release 最初のリリース No other presentation tool for a Rubyist even now 今でもRubyist用のプレゼンツールは他にない ✓ ✓ 2010: Matz migrated to Rabbit まつもとさんがRabbitに乗り換えた Since RubyKaigi 2010? RubyKaigi 2010から? ✓ ✓
  • 39. My way with Ruby Powered by Rabbit 2.2.2 For Rubyist? Rubyist向けに必要なもの RD supportRDサポート
  • 40. My way with Ruby Powered by Rabbit 2.2.2 RD Ruby Document Designed by Matz (Right?) まつもとさんがデザインしたはず ✓ ✓ A text based markup language テキストベースのマークアップ言語 Version controllable バージョン管理できる ✓ ✓
  • 41. My way with Ruby Powered by Rabbit 2.2.2 For Rubyist? Rubyist向けに必要なもの Publish our slides as usualいつも通りスライドを公開できる
  • 42. My way with Ruby Powered by Rabbit 2.2.2 Publish as usual いつも通り公開 % gem push your-slide-1.0.gem
  • 43. My way with Ruby Powered by Rabbit 2.2.2 Published! 公開完了! https://slide.rabbit-shocker.org/
  • 44. My way with Ruby Powered by Rabbit 2.2.2 What's needed for presentation tool? プレゼンツールに必要なもの GUI
  • 45. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GTK3 Multi-platform GUI toolkit複数プラットフォーム対応GUIツールキット
  • 46. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GTK3 - History 歴史 1998-01: 1st release by Matz [ruby-list:5877] まつもとさんが最初のリリース ✓ 2004-05: I joined development 私が開発に参加 ✓
  • 47. My way with Ruby Powered by Rabbit 2.2.2 Example - Window require "gtk3" app = Gtk::Application.new app.signal_connect(:activate) do window = Gtk::ApplicationWindow.new(app) window.show_all end app.run
  • 48. My way with Ruby Powered by Rabbit 2.2.2 Approaches on missing libraries(1) ライブラリーがない時のやり方(1) Implement only the needed features 必要な機能だけ実装 1. then back to Rabbit 必要な機能ができたらRabbitに戻る 2.
  • 49. My way with Ruby Powered by Rabbit 2.2.2 Approaches on missing libraries(2) ライブラリーがない時のやり方(2) Implement not only the needed features 必要な機能だけじゃなく 1. but also almost all features ほぼすべての機能を実装 2. then back to Rabbit 終わったらRabbitに戻る 3.
  • 50. My way with Ruby Powered by Rabbit 2.2.2 My approach 私のやり方 Implement all featurestesting with Rabbit すべての機能を実装
  • 51. My way with Ruby Powered by Rabbit 2.2.2 My priority 私の優先度 Rabbit is important Rabbitは大事だけど ✓ Increasing what Ruby can do is important too Rubyでできることを増やすのも大事 ✓
  • 52. My way with Ruby Powered by Rabbit 2.2.2 GTK+ 3 - Size サイズ 3000 over APIs3000以上のAPI
  • 53. My way with Ruby Powered by Rabbit 2.2.2 How to implement 実装方法 Handwriting手書き ↓ Auto generation自動生成
  • 54. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GI Generate bindings automatically at run-time実行時に自動でバインディングを生成 GI: GObject Introspection
  • 55. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GI - History 歴史 2012: The first commit by me 最初のコミット ✓ 2014: Ruby/GTK3 used Ruby/GI Ruby/GTK3をRuby/GIベースに移行 ✓
  • 56. My way with Ruby Powered by Rabbit 2.2.2 Handwriting 手書き Ruby scriptRuby/GTK3 Handwritten bindings libgtk-3 Ruby C
  • 57. My way with Ruby Powered by Rabbit 2.2.2 Auto generation 自動生成 Ruby scriptRuby/GTK3 Generated at run-time Gtk-3.0.typelib Ruby/GI GI = GObject Introspection libgtk-3 Ruby C Data
  • 58. My way with Ruby Powered by Rabbit 2.2.2 Performance(性能) Slower than handwriting 手書きより遅い ✓ Overhead オーバーヘッド Dynamic arguments conversion 動的な引数の変換 ✓ libffi based function call libffiを使った関数呼び出し ✓ ✓
  • 59. My way with Ruby Powered by Rabbit 2.2.2 Improve idea(改善案) JIT compilingJITコンパイル
  • 60. My way with Ruby Powered by Rabbit 2.2.2 JIT compiling(JITコンパイル) VALUE rb_method_generic() { func = dlsym(name); ... ffi_call(func, ..., &result); return C2RB(result); } ↓ // Build rb_method() at run-time and call it. VALUE rb_method() {return C2RB(name(...));}
  • 61. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GI - See also 参考情報 "How to create bindings 2016" at RubyKaigi 2016 http://rubykaigi.org/2016/presentations/ktou.html✓ ✓ "GI Introduction" (in Japanese) 「GObject Introspection入門」 https://github.com/RubyData/workshop-materials/ blob/master/gobject-introspection/introduction.md ✓ Build system: Meson + Ninja ビルドシステム:Meson + Ninja ✓ ✓
  • 62. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GI based bindings Ruby/GIベースのバインディング Ruby/Pango
  • 63. My way with Ruby Powered by Rabbit 2.2.2 Ruby/Pango Text layout engine with i18n support国際化対応のテキストレイアウトエンジン i18n: Internationalization
  • 64. My way with Ruby Powered by Rabbit 2.2.2 Prohibition processing 禁則処理 widget.signal_connect(:draw) do |_, context| layout = context.create_pango_layout layout.text = "Helloこんにちは。 " context.show_pango_layout(layout) GLib::Source::CONTINUE end
  • 65. My way with Ruby Powered by Rabbit 2.2.2 Bidirectional text 双方向テキスト Hello ‫م‬‫ر‬‫ح‬‫ب‬‫ا‬ こんにちは
  • 66. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GI based bindings Ruby/GIベースのバインディング Ruby/GdkPixbuf2
  • 67. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GdkPixbuf2 Image manipulation画像操作
  • 68. My way with Ruby Powered by Rabbit 2.2.2 Half image 画像を半分に require "gdk_pixbuf2" # Load an image: Format is auto detected pixbuf = GdkPixbuf::Pixbuf.new(file: "x.png") # Scale to half size half = pixbuf.scale(pixbuf.width / 2, pixbuf.height / 2, :bilinear) # Save as different format half.save("half.jpg")
  • 69. My way with Ruby Powered by Rabbit 2.2.2 Animated GIF アニメーションGIF
  • 70. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GI based bindings Ruby/GIベースのバインディング Ruby/Poppler
  • 71. My way with Ruby Powered by Rabbit 2.2.2 Ruby/Poppler PDF parser/rendererPDFパーサー・レンダラー
  • 72. My way with Ruby Powered by Rabbit 2.2.2 Text extraction テキスト抽出 require "poppler" doc = Poppler::Document.new("x.pdf") doc.each do |page| puts(page.text) # Extract all texts end
  • 73. My way with Ruby Powered by Rabbit 2.2.2 Embed PDF PDFの埋め込み Improve extension API - C++ as better language for extension Powered by Rabbit 2.2.2 Improve extension API C++ as better language for extension Kouhei Sutou ClearCode Inc. RubyKaigi 2017 2017-09-18 http://rubykaigi.org/2017/presentations/ktou.html
  • 74. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GI based bindings Ruby/GIベースのバインディング Ruby/GStreamer
  • 75. My way with Ruby Powered by Rabbit 2.2.2 Ruby/GStreamer Audio/Video player音声・動画プレイヤー (*) Streaming media framework 本当はストリーミングメディアフレームワーク
  • 76. My way with Ruby Powered by Rabbit 2.2.2 Camera(カメラ) require "gst" description = [ "autovideosrc", # Camera "videoconvert", # Filter "autovideosink", # Window ].join(" ! ") pipeline = Gst.parse_launch(description) pipeline.play until pipeline.bus.poll.type.eos? do end # Main loop pipeline.stop
  • 77. My way with Ruby Powered by Rabbit 2.2.2 Face detection(顔認識) description = [ "autovideosrc", # Camera "videoconvert", # Filter "facedetect", # Face detection (!) "videoconvert", # Filter (!) "autovideosink", # Window ].join(" ! ") pipeline = Gst.parse_launch(description) pipeline.play
  • 78. My way with Ruby Powered by Rabbit 2.2.2 What's needed for presentation tool? プレゼンツールに必要なもの PDF outputPDF出力
  • 79. My way with Ruby Powered by Rabbit 2.2.2 rcairo 2D graphics renderer2次元画像レンダラー
  • 80. My way with Ruby Powered by Rabbit 2.2.2 rcairo - Outputs 出力 PNG・SVG✓ PDF✓ Display (X/macOS/Windows)✓ ...✓
  • 81. My way with Ruby Powered by Rabbit 2.2.2 rcairo - History 歴史 2003-10: The initial commit 最初のコミット ✓ 2005-09: I started developing 私が開発に参加 ✓
  • 82. My way with Ruby Powered by Rabbit 2.2.2 Red A4 PDF 赤いA4のPDFを出力 require "cairo" include Cairo PDFSurface.create("x.pdf", "A4") do |surface| Context.create(surface) do |context| context.set_source_color(:red) context.paint end end
  • 83. My way with Ruby Powered by Rabbit 2.2.2 rcairo - GC 11 11.5 12 12.5 13 13.5 14 14.5 15 0 100 200 300 400 500 600 700 800 900 1000 Memoryusage(MiB) Nth loop 1000.times do Cairo::ImageSurface.new(:argb32, 6000, 6000) end
  • 84. My way with Ruby Powered by Rabbit 2.2.2 GC - Cause(原因) 11 11.5 12 12.5 13 13.5 14 14.5 15 0 100 200 300 400 500 600 700 800 900 1000 Memoryusage(MiB) Nth loop GC isn't run often enough GCの実行頻度が十分じゃなかった Because Ruby doesn't know how much memory used by cairo Rubyはcairoのメモリー使用量を知らないから ✓ ✓
  • 85. My way with Ruby Powered by Rabbit 2.2.2 GC - Fix(修正) 11 11.5 12 12.5 13 13.5 14 14.5 15 0 100 200 300 400 500 600 700 800 900 1000 Memoryusage(MiB) Nth loop rb_gc_adjust_memory_usage() Improve GC frequency(GC実行頻度を改善)✓ ✓ Ruby 2.4 ships it(Ruby 2.4以降)✓
  • 86. My way with Ruby Powered by Rabbit 2.2.2 What's needed for presentation tool? プレゼンツールに必要なもの Easy to install簡単インストール
  • 87. My way with Ruby Powered by Rabbit 2.2.2 native-package-installer Install system packages on gem install gem install時にシステムのパッケージをインストール
  • 88. My way with Ruby Powered by Rabbit 2.2.2 extconf.rb/Rakefile require "pkg-config" require "native-package-installer" unless PKGConfig.check_version?("gdk-3.0") packages = { altlinux: "libgtk+3-devel", debian: "libgtk-3-dev", redhat: "pkgconfig(gdk-3.0)", homebrew: "gtk+3", macports: "gtk3", msys2: "gtk3", } unless NativePackageInstaller.install(packages) exit(false) end end
  • 89. My way with Ruby Powered by Rabbit 2.2.2 rake-compiler Build fat gem by cross compileクロスコンパイルでfat gemをビルド
  • 90. My way with Ruby Powered by Rabbit 2.2.2 rake-compiler - History 歴史 2008-11: The first commit 最初のコミット ✓ 2014-12: Orphan だれかメンテナー変わってー ✓ 2014-12: I became the maintainer 私がメンテナーになった ✓
  • 91. My way with Ruby Powered by Rabbit 2.2.2 Opening3 きっかけ3 Testテスト
  • 92. My way with Ruby Powered by Rabbit 2.2.2 test-unit Testing framework to write tests in RubyRubyでテストを書けるテスティングフレームワーク
  • 93. My way with Ruby Powered by Rabbit 2.2.2 test-unit - History 歴史 2003-02: Import to Ruby Rubyに取り込まれる ✓ 2008-05: I became the maintainer 私がメンテナーになった ✓ 2008-10: Removed from Ruby Rubyから削除 ✓ See also: "The history of testing framework in Ruby" http://rubykaigi.org/2015/presentations/kou
  • 94. My way with Ruby Powered by Rabbit 2.2.2 test-unit - New feature 新機能 Groupingグループ化
  • 95. My way with Ruby Powered by Rabbit 2.2.2 Grouping グループ化 The most important feature 一番大事な機能 ✓ Keep tests maintainable メンテナンスできるテストを維持できる ✓
  • 96. My way with Ruby Powered by Rabbit 2.2.2 Example(例) class StackTest < Test::Unit::TestCase class PushTest < self def test_XXX; end end class PopTest < self def test_XXX; end end end
  • 97. My way with Ruby Powered by Rabbit 2.2.2 Method style(メソッド形式) class StackTest < Test::Unit::TestCase sub_test_case("#push") do def test_XXX; end end sub_test_case("#pop") do def test_XXX; end end end
  • 98. My way with Ruby Powered by Rabbit 2.2.2 test-unit - New feature 新機能 Data driven testデータ駆動テスト
  • 99. My way with Ruby Powered by Rabbit 2.2.2 Data driven test データ駆動テスト data("positive", [3, 1, 2]) data("negative", [-4, 1, -5]) def test_add(data) expected, augend, addend = data assert_equal(expected, add(augend, addend)) end
  • 100. My way with Ruby Powered by Rabbit 2.2.2 test-unit - New feature 新機能 Reverse backtrace逆順のバックトレース
  • 101. My way with Ruby Powered by Rabbit 2.2.2 Reverse backtrace 逆順のバックトレース Reverse backtrace only for terminal output ターミナル出力のときだけ逆順 ✓ The same change as Ruby 2.5.0 Ruby 2.5.0と同じ変更 ✓
  • 102. My way with Ruby Powered by Rabbit 2.2.2 test-unit - New feature 新機能 Test doubleテストダブル
  • 103. My way with Ruby Powered by Rabbit 2.2.2 test-unit-rr RR integrationRRとの統合
  • 104. My way with Ruby Powered by Rabbit 2.2.2 RR - History 歴史 2007-06: The initial commit 最初のコミット ✓ 2014-12: Orphan だれかメンテナー変わってー ✓ 2015-05: I became the maintainer 私がメンテナーになった ✓
  • 105. My way with Ruby Powered by Rabbit 2.2.2 Stub(スタブ) adder = Object.new adder.add(1, 2) # => Error stub(adder).add(1, 2) {3} adder.add(1, 2) # => 3
  • 106. My way with Ruby Powered by Rabbit 2.2.2 Opening4 きっかけ4 Full text search全文検索
  • 107. My way with Ruby Powered by Rabbit 2.2.2 Rroonga Full text search library全文検索ライブラリー
  • 108. My way with Ruby Powered by Rabbit 2.2.2 Library vs Client ライブラリー対クライアント No server process サーバープロセスがいらない ✓ Easy to start 簡単に使い始められる ✓ Write in Ruby Rubyで書ける ✓
  • 109. My way with Ruby Powered by Rabbit 2.2.2 Create DB(データベース作成) require "groonga" Groonga::Database.create(path: "/tmp/db")
  • 110. My way with Ruby Powered by Rabbit 2.2.2 Define schema(スキーマ定義) Groonga::Schema.define do |schema| schema.create_table("docs") do |table| # The column to store text table.text("content") end # The index for full text search schema.create_lexicon("terms") do |table| table.index("docs.content") end end
  • 111. My way with Ruby Powered by Rabbit 2.2.2 Add records(レコード追加) docs = Groonga["docs"] docs.add(content: "String#<< concatenates ...") docs.add(content: "String#dup duplicates ...")
  • 112. My way with Ruby Powered by Rabbit 2.2.2 Search(検索) matches = docs.select do |record| record.content.match("concat") end p matches.size # => 1 matches.each do |record| p record.content # => "String#<< concat..." end
  • 113. My way with Ruby Powered by Rabbit 2.2.2 User - Rabbit Slide Show https://slide.rabbit-shocker.org/
  • 114. My way with Ruby Powered by Rabbit 2.2.2 User - Rurema Search https://docs.ruby-lang.org/ja/search/
  • 115. My way with Ruby Powered by Rabbit 2.2.2 Rurema Search るりまサーチ Super fast! すごく速い! ✓ Tuned for Ruby documents Rubyのドキュメント用にチューニング ✓
  • 116. My way with Ruby Powered by Rabbit 2.2.2 User - RDoc Search Planning 考えてはいるけど。。。 ✓ Do you want to work with me? 一緒にやりたい人はいる? ✓
  • 117. My way with Ruby Powered by Rabbit 2.2.2 Rurema and RDoc Project Language Target Rurema Japanese Japanese Rubyists RDoc English All Rubyists
  • 118. My way with Ruby Powered by Rabbit 2.2.2 Source ソース Shared nothing 共有していない Copy based share 共有するときはコピー ✓ e.g.: Description, Sample codes, ... 例:説明やサンプルコードなどをコピー ✓ ✓
  • 119. My way with Ruby Powered by Rabbit 2.2.2 From my point of view 私が思うこと Can we share documents? ドキュメントを共有できないかな ✓ How to work together deeply? もっと協力してできないかな ✓
  • 120. My way with Ruby Powered by Rabbit 2.2.2 I18n 国際化 Source: RDoc ソースはRDoc For all Rubyists これは全Rubyist向け ✓ ✓ Translate to Japanese RDocのドキュメントを日本語に翻訳 For Japanese Rubyists これは日本人Rubyist向け ✓ ✓
  • 121. My way with Ruby Powered by Rabbit 2.2.2 Add i18n support 国際化サポートを追加 YARD Since 0.8.0 at 2012-04✓ ✓ RDoc Since 4.2.0 at 2014-12✓ ✓
  • 122. My way with Ruby Powered by Rabbit 2.2.2 YARD - i18n # Generates po/yard.pot # po/yard.potを生成 % yard i18n
  • 123. My way with Ruby Powered by Rabbit 2.2.2 YARD - i18n # Create po/ja.po from po/yard.pot # po/yard.potからpo/ja.poを作成 % msginit --locale=ja_JP.UTF-8 --input=po/yard.pot --output-file=po/ja.po
  • 124. My way with Ruby Powered by Rabbit 2.2.2 YARD - i18n # Translate messages in po/ja.po # po/ja.po内のメッセージを翻訳 % editor po/ja.po
  • 125. My way with Ruby Powered by Rabbit 2.2.2 YARD - i18n # Generate documents with # translated messages # 翻訳したメッセージを使って # ドキュメント生成 % yard --locale ja
  • 126. My way with Ruby Powered by Rabbit 2.2.2 Packnga Rake task for YARD i18nYARDの国際化機能向けのRakeタスク
  • 127. My way with Ruby Powered by Rabbit 2.2.2 Setting 設定 # Rakefile require "packnga" Packnga::DocumentTask.new(spec) do |task| task.original_language = "en" task.translate_languages = ["ja"] end
  • 128. My way with Ruby Powered by Rabbit 2.2.2 Workflow ワークフロー % rake reference:translate % editor doc/po/ja/x.edit.po % rake reference:translate % editor lib/x.rb % rake reference:translate ...
  • 129. My way with Ruby Powered by Rabbit 2.2.2 Users ユーザー test-unit✓ Rroonga✓ ...✓
  • 130. My way with Ruby Powered by Rabbit 2.2.2 RDoc - i18n # Generates doc/rdoc.pot # doc/rdoc.potを生成 % rdoc --format=pot
  • 131. My way with Ruby Powered by Rabbit 2.2.2 RDoc - i18n # Create locale/ja.po # from doc/rdoc.pot # doc/rdoc.potからlocale/ja.poを作成 % mkdir -p locale % msginit --locale=ja_JP.UTF-8 --input=doc/rdoc.pot --output-file=locale/ja.po
  • 132. My way with Ruby Powered by Rabbit 2.2.2 RDoc - i18n # Translate messages in locale/ja.po # locale/ja.po内のメッセージを翻訳 % editor locale/ja.po
  • 133. My way with Ruby Powered by Rabbit 2.2.2 RDoc - i18n # Generate documents with # translated messages # 翻訳したメッセージを使って # ドキュメント生成 % rdoc --locale ja
  • 134. My way with Ruby Powered by Rabbit 2.2.2 RDoc, Rurema and i18n No progress... ツールの整備まででそれ以降は進んでいない。。。 ✓ Do you want to work with me? 一緒にやりたい人はいる? ✓
  • 135. My way with Ruby Powered by Rabbit 2.2.2 jekyll-task-i18n Jekyll + i18n
  • 136. My way with Ruby Powered by Rabbit 2.2.2 Features 機能 Support all markups! すべてのマークアップ対応! ✓ GitHub Pages ready! GitHub Pagesでも使える! ✓
  • 137. My way with Ruby Powered by Rabbit 2.2.2 Setting(設定) # Rakefile require "jekyll/task/i18n" Jekyll::Task::I18n.define do |task| task.locales = ["ja"] task.files = Rake::FileList["**/*.md"] task.files -= Rake::FileList["_*/**/*.md"] task.locales.each do |locale| task.files -= Rake::FileList["#{locale}/**/*.md"] end end task default: ["jekyll:i18n:translate"]
  • 138. My way with Ruby Powered by Rabbit 2.2.2 Workflow(ワークフロー) % editor index.md % rake % editor _po/ja/index.edit.po % rake % git commit -a
  • 139. My way with Ruby Powered by Rabbit 2.2.2 User - Red Data Tools https://red-data-tools.github.io/
  • 140. My way with Ruby Powered by Rabbit 2.2.2 groonga-client Full text search client全文検索クライアント
  • 141. My way with Ruby Powered by Rabbit 2.2.2 Library vs Client ライブラリー対クライアント Less dependencies 依存関係が少ない ✓ Less resources needed 必要なリソースが少ない ✓
  • 142. My way with Ruby Powered by Rabbit 2.2.2 Search(検索) require "groonga/client" url = "http://localhost:10041" Groonga::Client.open(url: url) do |client| response = client.select(table: "docs", match_columns: "content", query: "concat") p response.n_hits # => 1 end
  • 143. My way with Ruby Powered by Rabbit 2.2.2 Asynchronous(非同期) # Call with block client.select(table: "docs", match_columns: "content", query: "concat") do |response| p response.n_hits # => 1 end p :here # => :here then ↑ sleep(0.1)
  • 144. My way with Ruby Powered by Rabbit 2.2.2 Asynchronous - wait request = client.select(table: "docs", match_columns: "content", query: "concat") do |response| p response.n_hits # => 1 end p :here # => :here then ↑ request.wait
  • 145. My way with Ruby Powered by Rabbit 2.2.2 groonga-client-rails Ruby on Rails integration for groonga-clientRuby on Railsで使う
  • 146. My way with Ruby Powered by Rabbit 2.2.2 Architecture アーキテクチャー Data: RDBMS データはRDBMSに格納 ✓ Full text search: Groonga 全文検索はGroongaで処理 ✓
  • 147. My way with Ruby Powered by Rabbit 2.2.2 Define app searcher アプリ用サーチャーを定義 # app/searchers/application_searcher.rb class ApplicationSearcher < Groonga::Client::Searcher end
  • 148. My way with Ruby Powered by Rabbit 2.2.2 Define searcher サーチャーを定義 # app/searchers/document_searcher.rb class DocumentsSearcher < ApplicationSearcher # Define a full text search index as "content" # 全文検索用のインデックスを定義 schema.column :content, { type: "Text", index: true, index_type: :full_text_search, } end
  • 149. My way with Ruby Powered by Rabbit 2.2.2 Bind to model モデルと結びつける # app/models/document.rb class Document < ApplicationRecord # DocumentsSearcher searches Document model source = DocumentsSearcher.source(self) # Bind Document's "content" column to # DocumentsSearcher's "content" index source.content = :content end
  • 150. My way with Ruby Powered by Rabbit 2.2.2 Search(検索) # app/controllers/documents_controller.rb class DocumentsController < ApplicationController def index @query = params[:query] searcher = DocumentSearcher.new @result_set = searcher.search. query(@query). result_set end end
  • 151. My way with Ruby Powered by Rabbit 2.2.2 See also 参考情報 Tutorial in Japanese 日本語のチュートリアル http://www.clear-code.com/blog/2016/12/22.html✓ ✓
  • 152. My way with Ruby Powered by Rabbit 2.2.2 Ranguba (WIP)(開発中) Full text search system全文検索システム
  • 153. My way with Ruby Powered by Rabbit 2.2.2 Use cases 利用例 File server search ファイルサーバー検索 ✓ E-mail search メール検索 ✓ Web site search Webサイト検索 ✓
  • 154. My way with Ruby Powered by Rabbit 2.2.2 Features 機能 Crawlers クローラー ✓ Web UI✓ Command line interface Update documents 更新 ✓ Search documents 検索 ✓ ✓
  • 155. My way with Ruby Powered by Rabbit 2.2.2 ChupaText Text extractorテキスト抽出
  • 156. My way with Ruby Powered by Rabbit 2.2.2 Supported formats 対応フォーマット PDF✓ Office documents(オフィス文書) OpenDocument, Word, Excel, ...✓ ✓ E-mail(メール)✓ ...✓
  • 157. My way with Ruby Powered by Rabbit 2.2.2 Interface インターフェイス HTTP✓ Web UI✓ Command line interface✓ API (Library)✓
  • 158. My way with Ruby Powered by Rabbit 2.2.2 Install - Docker % GITHUB=https://github.com % git clone ${GITHUB}/ranguba/chupa-text-docker.git % cd chupa-text-docker % docker-compose up --build
  • 159. My way with Ruby Powered by Rabbit 2.2.2 How to use 使い方 % curl --form data=@XXX.pdf http://localhost:20080/extraction.json
  • 160. My way with Ruby Powered by Rabbit 2.2.2 Use cases 利用例 Ranguba Full text search system 全文検索システム ✓ ✓ Commit e-mail コミットメール ✓
  • 161. My way with Ruby Powered by Rabbit 2.2.2 git-commit-mailer Commit e-mail for GitGit用のコミットメール
  • 162. My way with Ruby Powered by Rabbit 2.2.2 Features 機能 HTML mail HTMLメール Highlighted diff diffをハイライト ✓ ✓ GitLab/GitHub Web hook GitLab/GitHubのWebフック対応 By GitHub:clear-code/github-web-hooks-receiver✓ ✓
  • 163. My way with Ruby Powered by Rabbit 2.2.2 Users 利用者 tDiary✓ My products✓
  • 164. My way with Ruby Powered by Rabbit 2.2.2 commit-email.info Commit e-mail as a Serviceコミットメールのクラウドサービス
  • 165. My way with Ruby Powered by Rabbit 2.2.2 How to use 使い方 Send a pull request to GitHub:kou/commit-email.info pull requestを送る ✓ Register a Web hook Webフックを登録 ✓ Subscribe your mailing list メーリングリストを購読 ✓ See also http://www.commit-email.info/
  • 166. My way with Ruby Powered by Rabbit 2.2.2 Opening5 きっかけ5 Data processingデータ処理
  • 167. My way with Ruby Powered by Rabbit 2.2.2 csv CSV parserCSVパーサー
  • 168. My way with Ruby Powered by Rabbit 2.2.2 csv - History 歴史 2003: Import Rubyに取り込み ✓ 2007: Replaced with FasterCSV FasterCSVで置き換え ✓ 2018: I became a co- maintainer with mrkn mrknと一緒にメンテナーになった ✓
  • 169. My way with Ruby Powered by Rabbit 2.2.2 Why? なんで? There are many data sources in CSV CSVのデータはたくさんある ✓ Important to process data データを処理するためにCSVパーサーは重要 ✓
  • 170. My way with Ruby Powered by Rabbit 2.2.2 CSV format problems CSVフォーマットの問題 Slow to parse パースが遅い ✓ Too wild なんでもあり ✓
  • 171. My way with Ruby Powered by Rabbit 2.2.2 Red Arrow Apache Arrow Ruby
  • 172. My way with Ruby Powered by Rabbit 2.2.2 Red Arrow - History 歴史 2017-02: The first commit 最初のコミット ✓ 2018-05: Became the "official" Ruby bindings of Apache Arrow Apache Arrowの公式Rubyバインディングになった ✓
  • 173. My way with Ruby Powered by Rabbit 2.2.2 Apache Arrow Super fast data format すごく速いデータフォーマット For in-memory data インメモリーデータ用 ✓ ✓ Cross-language support いろんな言語がサポート Easy to share data with Python, Java, ... PythonやJavaなどとデータ交換がしやすい ✓ ✓
  • 174. My way with Ruby Powered by Rabbit 2.2.2 Performance(性能) 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0 500 1000 1500 2000 2500 Loadtime(sec) N rows CSV Apache Arrow
  • 175. My way with Ruby Powered by Rabbit 2.2.2 Apache Arrow - Position 立ち位置 A very important piece in recent data processing 最近のデータ処理界隈ではすごく大事な1ピース Like JIT for Ruby 3 Ruby 3で例えるとJITみたいな感じ ✓ ✓
  • 176. My way with Ruby Powered by Rabbit 2.2.2 Red Arrow - Impl. 実装 Based on Ruby/GI Ruby/GIを使っている Auto generated bindings バインディングを自動生成 ✓ ✓
  • 177. My way with Ruby Powered by Rabbit 2.2.2 Extendable load API 拡張可能なロードAPI # Load Apache Arrow data Arrow::Table.load("iris.arrow") # Load CSV data Arrow::Table.load("iris.csv") # Load Apache Parquet data Arrow::Table.load("iris.parquet")
  • 178. My way with Ruby Powered by Rabbit 2.2.2 Apache Parquet Super fast data format すごく速いデータフォーマット For storing analysis target data 解析対象のデータを保存する用 ✓ ✓ Widely used 広く使われている ✓
  • 179. My way with Ruby Powered by Rabbit 2.2.2 Performance(性能) 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0 500 1000 1500 2000 2500 Loadtime(sec) N rows CSV Apache Arrow Apache Parquet
  • 180. My way with Ruby Powered by Rabbit 2.2.2 Red Parquet Apache Parquet
  • 181. My way with Ruby Powered by Rabbit 2.2.2 Red Data Tools A project to make Ruby data processableRubyでデータ処理できるようにするためのプロジェクト
  • 182. My way with Ruby Powered by Rabbit 2.2.2 Red Data Tools - History 歴史 2017-02: Start(開始)✓ 2017-11-: Develop events per month at Tokyo 東京で毎月開発イベントを開催 ✓
  • 183. My way with Ruby Powered by Rabbit 2.2.2 The number of products プロダクト数 About 20including Red Arrow and Red Parquet 20くらい Red ArrowやRed ParquetもRed Data Toolsプロダクツ
  • 184. My way with Ruby Powered by Rabbit 2.2.2 Red Datasets Dataset fetcherデータセット取得
  • 185. My way with Ruby Powered by Rabbit 2.2.2 Supported datasets 対応データセット Iris✓ CIFAR✓ Wikipedia✓
  • 186. My way with Ruby Powered by Rabbit 2.2.2 Wikipedia require "datasets" wikipedia = Datasets::Wikipedia.new wikipedia.each do |page| p page.title end
  • 187. My way with Ruby Powered by Rabbit 2.2.2 Wikipedia search pages = Groonga["pages"] wikipedia = Datasets::Wikipedia.new wikipedia.each do |page| pages.add(title: page.title, content: page.revision.text) end ruby_pages = pages.select do |record| record.match("Ruby OR Rails") do |target| (target.title * 10) | target.content end end p ruby_pages.size
  • 188. My way with Ruby Powered by Rabbit 2.2.2 jekyll-jupyter-notebook Jekyll + Jupyter Notebook
  • 189. My way with Ruby Powered by Rabbit 2.2.2 Usage 使い方 {% jupyter_notebook sample.ipynb %}
  • 190. My way with Ruby Powered by Rabbit 2.2.2 Red OpenCV Computer visionコンピュータービジョン
  • 191. My way with Ruby Powered by Rabbit 2.2.2 Camera(カメラ) require "cv" camera = CV::Camera.new image = camera.read image.write("capture.jpg")
  • 192. My way with Ruby Powered by Rabbit 2.2.2 Face detect(顔認識) image_gray = image.convert_color(:bgr2gray) classifier = # Face detector CV::CascadeClassifier.new("frontalface_alt") objects = classifier.detect(image_gray) color = CV::Color.new(0, 0, 255) objects.each do |object| # Draw detected area image.draw_rectangle(object, color) end image.write("detect.jpg")
  • 193. My way with Ruby Powered by Rabbit 2.2.2 Red OpenCV - Impl. 実装 Based on Ruby/GI Ruby/GIを使っている Auto generated bindings バインディングを自動生成 ✓ ✓
  • 194. My way with Ruby Powered by Rabbit 2.2.2 Ad: RubyData Workshop 2018-06-01 15:50/17:20✓ Contents:(内容) Workshop by mrkn mrknによるワークショップ ✓ Presentations from Red Data Tools members Red Data ToolsメンバーによるRed Data Toolsでやって きたことの紹介 ✓ ✓
  • 195. My way with Ruby Powered by Rabbit 2.2.2 Process data with Ruby Rubyでデータ処理 We're working on it Red Data Toolsは継続して取り組んでいる ✓ Do you want to work with us? 一緒にやりたい人はいる? ✓
  • 196. My way with Ruby Powered by Rabbit 2.2.2 How to join1(参加方法1) Join our chat rooms: チャットルームに参加 en: Gitter:red-data-tools/en✓ ja: Gitter:red-data-tools/ja✓ ✓ Join monthly events at Tokyo 東京での毎月の開発イベントに参加 https://speee.connpass.com/✓ ✓
  • 197. My way with Ruby Powered by Rabbit 2.2.2 How to join2(参加方法2) Hire developers to work on it 仕事として開発する開発者を雇う e.g.: mrkn by Speee, Inc. 例:Speeeの村田さん ✓ ✓
  • 198. My way with Ruby Powered by Rabbit 2.2.2 How to join3(参加方法3) Order ClearCode to work on it クリアコードに開発の仕事を発注 ✓ Join ClearCode to work on it クリアコードに入って仕事として開発を進める ✓
  • 199. My way with Ruby Powered by Rabbit 2.2.2 Wrap up まとめ I'm working on the following as a Rubyist Rubyistとしての私の活動 Increase what Ruby can do with free software フリーソフトウェアを使ってRubyでできることを増やす ✓ Maintain libraries ライブラリーのメンテナス ✓ ✓ Do you want to work with me? 一緒にやりたい人はいる? ✓