Skip to content

Commit fea4d1d

Browse files
committed
add improved Ruby version
1 parent 5c80429 commit fea4d1d

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The new optimized Golang code version is very fast, slower than Rust but faster
3131

3232
* Python = has a great implementation of [ICU](https://icu.unicode.org/related) library however it does not support arm64/M1 platform, hence I couldn't use it in this comparison.
3333

34-
* Ruby = can sort unicode text but withot collations becase it can't use ICU on arm64/M1
34+
* Ruby = can sort unicode text but without collations becase it can't use ICU on arm64/M1
3535

3636
* Elixir = same as Python, no ICU for M1.
3737

example-ruby/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
## setup and run
44

5+
Syntax
6+
57
```
6-
ruby words.rb
8+
❯ ruby words.rb -h
9+
Usage: ruby words.rb [options]
10+
-n [NUM] Number of cores to run (default 10)
11+
-s Sort results
712
```
813

14+
Run
15+
16+
```
17+
ruby word.rb -s
18+
```

example-ruby/words.rb

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require 'fileutils'
55
require 'optparse'
66

7-
class WordExtractor
7+
class WordsExtractor
88
def initialize(cores: Etc.nprocessors, sorting: false, outdir: 'words', source: '../data/??/**/*.yml')
99
@cores = cores
1010
@sorting = sorting
@@ -64,19 +64,5 @@ def run
6464
end
6565
opts.on('-s', 'Sort results') { |v| options[:s] = v }
6666
end.parse!
67-
WordExtractor.new(cores: options[:n], sorting: options[:s]).run
67+
WordsExtractor.new(cores: options[:n], sorting: options[:s]).run
6868
end
69-
70-
# class A
71-
# def initialize(x:, y:, z:)
72-
# @x = x
73-
# @y = y
74-
# @z = z
75-
# end
76-
77-
# def run
78-
# puts "x=#{@x}, y=#{@y}, z=#{@z}"
79-
# end
80-
# end
81-
82-
# A.new(y: 'Y', x: 'X', z: 'Z').run

0 commit comments

Comments
 (0)