laowaihua 0.1.0

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 ADDED
@@ -0,0 +1,13 @@
1
+ LaoWaiHua
2
+ =========
3
+
4
+ A "Lorem Ipsum" generator for Chinese (simplified)
5
+
6
+ Example
7
+ =======
8
+
9
+ >> require 'laowaihua'
10
+
11
+ >> LaoWaiHua(25)
12
+ => "一位爷爷他姓顾,上街打醋又买布。买了布,打了醋,回"
13
+
@@ -0,0 +1,30 @@
1
+ module LaoWaiHua
2
+
3
+ WORDS = %w(
4
+ 一 位 爷 爷 他 姓 顾 ,
5
+ 上 街 打 醋 又 买 布 。
6
+ 买 了 布 , 打 了 醋 ,
7
+ 回 头 看 见 鹰 抓 兔 。
8
+ 放 下 布 , 搁 下 醋 ,
9
+ 上 前 去 追 鹰 和 兔 ,
10
+ 飞 了 鹰 , 跑 了 兔 。
11
+ 打 翻 醋 , 醋 湿 布
12
+ )
13
+
14
+ def self.generate(length=WORDS.length)
15
+ words = []
16
+ while words.length < length
17
+ words += LaoWaiHua::WORDS[0, length]
18
+ end
19
+ words.join("")
20
+ end
21
+
22
+ end
23
+
24
+ def LaoWaiHua(*args)
25
+ LaoWaiHua.generate(*args)
26
+ end
27
+
28
+ if defined?(Rails)
29
+ require 'lao_wai_hua/railtie'
30
+ end
@@ -0,0 +1,10 @@
1
+ require 'rails'
2
+ module LaoWaiHua
3
+ class Railtie < Rails::Railtie
4
+ railtie_name :lao_wai_hua
5
+
6
+ rake_tasks do
7
+ load "tasks/lao_wai_hua.rake"
8
+ end
9
+ end
10
+ end
data/lib/laowaihua.rb ADDED
@@ -0,0 +1 @@
1
+ require 'lao_wai_hua'
@@ -0,0 +1,7 @@
1
+ desc "Generate some LaoWaiHua with optional LENGTH"
2
+ task :laowaihua => :environment do
3
+ require "lao_wai_hua"
4
+ args = []
5
+ args << ENV["LENGTH"].to_i if ENV.has_key?("LENGTH")
6
+ puts LaoWaiHua(*args)
7
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: laowaihua
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Matthew Rudy
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-25 00:00:00 +08:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email: matthewrudyjacobs@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README
29
+ files:
30
+ - README
31
+ - lib/lao_wai_hua/railtie.rb
32
+ - lib/lao_wai_hua.rb
33
+ - lib/laowaihua.rb
34
+ - lib/tasks/lao_wai_hua.rake
35
+ has_rdoc: true
36
+ homepage: http://github.com/matthewrudy/laowaihua
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options:
41
+ - --main
42
+ - README
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ segments:
50
+ - 0
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ requirements: []
60
+
61
+ rubyforge_project:
62
+ rubygems_version: 1.3.6
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: a Lorem Ipsum generator for Chinese
66
+ test_files: []
67
+