chh_moretext 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # ChhMoretext
2
2
 
3
- TODO: Write a gem description
3
+ Generate random Traditional Chinese text from Moretext API.
4
+
5
+ 透過 [Handlino][handlino] 的 [Moretext API][moretext-api] 產生隨機中文句子或段落。
6
+
7
+ [handlino]: http://handlino.com/
8
+ [moretext-api]: http://more.handlino.com/api
4
9
 
5
10
  ## Installation
6
11
 
@@ -18,7 +23,35 @@ Or install it yourself as:
18
23
 
19
24
  ## Usage
20
25
 
21
- TODO: Write usage instructions here
26
+ ``` ruby
27
+ ChhMoretext::Moretext.sentence
28
+ # 取得一個長度隨機的句子
29
+
30
+ ChhMoretext::Moretext.sentence(5..10)
31
+ # 取得一個長度 5 到 10 個字個句子,可以用範圍(Range)或是整數(Integer)
32
+
33
+ ChhMoretext::Moretext.sentences(2, 7)
34
+ # 基本上跟 `sentence` 一樣,但是可以指定要取得幾個句子
35
+ # 以此例來說,會取得 2 個 7 個字的句子
36
+
37
+ ChhMoretext::Moretext.paragraph
38
+ # 取得一個段落,預設是由 3 個句子(`sentence`)合併組成
39
+
40
+ ChhMoretext::Moretext.paragraph(10)
41
+ # 也可以指定要用幾個句子組成
42
+
43
+ ChhMoretext::Moretext.paragraphs
44
+ # 取得一篇文章,預設由三個段落(`paragraph`)合併組成
45
+
46
+ ChhMoretext::Moretext.paragraphs(5)
47
+ # 也可以指定要有幾個段落
48
+ ```
49
+
50
+ ## TODO
51
+
52
+ * 目前每呼叫一個方法就是一個 request,造成產生假文的速度非常緩慢,打算弄個「快取層」先把資料抓來,呼叫方法時從快取裡面去拿;
53
+ * 目前的 `paragraphs` 方法是將 `sentences` 用 `"\r\n\r\n"` 合併的,應該讓開發者可以自訂要用什麼拼接,例如用 HTML 的 `<p></p>` 等等;
54
+ * 想做一個中文姓名產生器……
22
55
 
23
56
  ## Contributing
24
57
 
data/chh_moretext.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.email = ["chh@chh.tw"]
12
12
  gem.description = %q{Generate random Traditional Chinese text from Moretext API}
13
13
  gem.summary = %q{Generate random Traditional Chinese text from Moretext API}
14
- gem.homepage = "https://github.com/chinghanho/chh-moretext"
14
+ gem.homepage = "https://github.com/chinghanho/chh_moretext"
15
15
 
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,3 +1,3 @@
1
1
  module ChhMoretext
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chh_moretext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,7 +27,7 @@ files:
27
27
  - lib/chh_moretext.rb
28
28
  - lib/chh_moretext/moretext.rb
29
29
  - lib/chh_moretext/version.rb
30
- homepage: https://github.com/chinghanho/chh-moretext
30
+ homepage: https://github.com/chinghanho/chh_moretext
31
31
  licenses: []
32
32
  post_install_message:
33
33
  rdoc_options: []