inochi 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +17 -1
- data/bin/inochi +19 -539
- data/lib/inochi.rb +1 -41
- data/lib/inochi/engine.rb +101 -0
- data/lib/inochi/generate.rb +52 -0
- data/lib/inochi/inochi.rb +109 -0
- data/lib/inochi/tasks/ann.rake +230 -0
- data/lib/inochi/tasks/api.rake +28 -0
- data/lib/inochi/tasks/gem.rake +46 -0
- data/lib/inochi/tasks/init.rake +38 -0
- data/lib/inochi/tasks/man.rake +78 -0
- data/lib/inochi/tasks/project.rake +25 -0
- data/lib/inochi/tasks/pub.rake +130 -0
- data/lib/inochi/templates/CREDITS.rbs +18 -0
- data/lib/inochi/templates/EXAMPLES.rbs +24 -0
- data/lib/inochi/templates/FURTHER.rbs +17 -0
- data/lib/inochi/templates/HACKING.rbs +92 -0
- data/lib/inochi/templates/HISTORY.rbs +55 -0
- data/lib/inochi/templates/LICENSE.rbs +15 -0
- data/lib/inochi/templates/MANUAL.rbs +27 -0
- data/lib/inochi/templates/README.rbs +60 -0
- data/lib/inochi/templates/USAGE.rbs +23 -0
- data/lib/inochi/templates/command.rbs +23 -0
- data/lib/inochi/templates/inochi.opts.rbs +43 -0
- data/lib/inochi/templates/inochi.rb.rbs +102 -0
- data/lib/inochi/templates/library.rbs +7 -0
- data/lib/inochi/templates/library_test.rb.rbs +3 -0
- data/lib/inochi/templates/test_helper.rb.rbs +3 -0
- data/lib/inochi/templates/test_runner.rbs +25 -0
- data/{doc → logo}/inochi.png +0 -0
- data/man.html +959 -0
- data/man/man1/inochi.1.gz +0 -0
- metadata +129 -198
- data/doc/README +0 -6
- data/doc/api/apple-touch-icon.png +0 -0
- data/doc/api/classes/Array.html +0 -370
- data/doc/api/classes/File.html +0 -110
- data/doc/api/classes/Inochi.html +0 -1477
- data/doc/api/classes/Inochi/Manual.html +0 -157
- data/doc/api/classes/Inochi/Phrases.html +0 -331
- data/doc/api/classes/Inochi/Version.html +0 -190
- data/doc/api/classes/TempDir.html +0 -164
- data/doc/api/created.rid +0 -1
- data/doc/api/css/main.css +0 -263
- data/doc/api/css/panel.css +0 -383
- data/doc/api/css/reset.css +0 -53
- data/doc/api/favicon.ico +0 -0
- data/doc/api/files/CREDITS.html +0 -61
- data/doc/api/files/LICENSE.html +0 -76
- data/doc/api/files/lib/inochi/book_rb.html +0 -106
- data/doc/api/files/lib/inochi/init_rb.html +0 -66
- data/doc/api/files/lib/inochi/main_rb.html +0 -52
- data/doc/api/files/lib/inochi/rake_rb.html +0 -52
- data/doc/api/files/lib/inochi/test/bacon_rb.html +0 -67
- data/doc/api/files/lib/inochi/test/context_rb.html +0 -69
- data/doc/api/files/lib/inochi/test/dfect_rb.html +0 -67
- data/doc/api/files/lib/inochi/test/matchy_rb.html +0 -69
- data/doc/api/files/lib/inochi/test/minitest_rb.html +0 -71
- data/doc/api/files/lib/inochi/test/mocha_rb.html +0 -67
- data/doc/api/files/lib/inochi/test/rspec_rb.html +0 -67
- data/doc/api/files/lib/inochi/test/shoulda_rb.html +0 -67
- data/doc/api/files/lib/inochi/test/test_spec_rb.html +0 -67
- data/doc/api/files/lib/inochi/test/test_unit_rb.html +0 -67
- data/doc/api/files/lib/inochi/util/combo_rb.html +0 -59
- data/doc/api/files/lib/inochi/util/tempdir_rb.html +0 -68
- data/doc/api/files/lib/inochi/util_rb.html +0 -59
- data/doc/api/files/lib/inochi_rb.html +0 -76
- data/doc/api/i/arrows.png +0 -0
- data/doc/api/i/results_bg.png +0 -0
- data/doc/api/i/tree_bg.png +0 -0
- data/doc/api/index.html +0 -14
- data/doc/api/js/jquery-1.3.2.min.js +0 -19
- data/doc/api/js/jquery-effect.js +0 -593
- data/doc/api/js/main.js +0 -22
- data/doc/api/js/searchdoc.js +0 -628
- data/doc/api/panel/index.html +0 -71
- data/doc/api/panel/search_index.js +0 -1
- data/doc/api/panel/tree.js +0 -1
- data/doc/history.erb +0 -268
- data/doc/index.erb +0 -11
- data/doc/index.html +0 -3179
- data/doc/inochi.svg +0 -405
- data/doc/intro.erb +0 -87
- data/doc/setup.erb +0 -105
- data/doc/usage.erb +0 -641
- data/lib/inochi/book.rb +0 -91
- data/lib/inochi/init.rb +0 -256
- data/lib/inochi/main.rb +0 -85
- data/lib/inochi/rake.rb +0 -902
- data/lib/inochi/test/bacon.rb +0 -3
- data/lib/inochi/test/context.rb +0 -4
- data/lib/inochi/test/dfect.rb +0 -3
- data/lib/inochi/test/matchy.rb +0 -4
- data/lib/inochi/test/minitest.rb +0 -7
- data/lib/inochi/test/mocha.rb +0 -3
- data/lib/inochi/test/rspec.rb +0 -3
- data/lib/inochi/test/shoulda.rb +0 -3
- data/lib/inochi/test/test_spec.rb +0 -3
- data/lib/inochi/test/test_unit.rb +0 -3
- data/lib/inochi/util.rb +0 -99
- data/lib/inochi/util/combo.rb +0 -191
- data/lib/inochi/util/tempdir.rb +0 -29
- data/rakefile +0 -12
- data/test/inochi.rb +0 -111
@@ -1,157 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<title>Inochi::Manual</title>
|
7
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
-
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
|
9
|
-
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
|
10
|
-
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
-
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
-
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
-
</head>
|
14
|
-
|
15
|
-
<body>
|
16
|
-
<div class="banner">
|
17
|
-
<h1>
|
18
|
-
<span class="type">Module</span>
|
19
|
-
Inochi::Manual
|
20
|
-
|
21
|
-
</h1>
|
22
|
-
<ul class="files">
|
23
|
-
|
24
|
-
<li><a href="../../files/lib/inochi/book_rb.html">lib/inochi/book.rb</a></li>
|
25
|
-
|
26
|
-
</ul>
|
27
|
-
</div>
|
28
|
-
<div id="bodyContent">
|
29
|
-
<div id="content">
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<div class="sectiontitle">Methods</div>
|
40
|
-
<dl class="methods">
|
41
|
-
|
42
|
-
<dt>H</dt>
|
43
|
-
<dd>
|
44
|
-
<ul>
|
45
|
-
|
46
|
-
<li><a href="#M000012">history</a></li>
|
47
|
-
|
48
|
-
</ul>
|
49
|
-
</dd>
|
50
|
-
|
51
|
-
<dt>P</dt>
|
52
|
-
<dd>
|
53
|
-
<ul>
|
54
|
-
|
55
|
-
<li><a href="#M000011">project</a></li>
|
56
|
-
|
57
|
-
</ul>
|
58
|
-
</dd>
|
59
|
-
|
60
|
-
</dl>
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
<div class="sectiontitle">Instance Public methods</div>
|
75
|
-
|
76
|
-
<div class="method">
|
77
|
-
<div class="title" id="M000012">
|
78
|
-
|
79
|
-
<a name="M000012"></a><b>history</b>()
|
80
|
-
|
81
|
-
</div>
|
82
|
-
|
83
|
-
<div class="description">
|
84
|
-
<p>
|
85
|
-
Contains release notes for all project releases.
|
86
|
-
</p>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
<div class="sourcecode">
|
94
|
-
<p class="source-link">
|
95
|
-
Source: <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show</a>
|
96
|
-
|
97
|
-
| <a href="http://github.com/sunaku/inochi/blob/94ea085869f0eab9b04917d057bdae5b64157781/lib/inochi/book.rb#L82" target="_blank" class="github_url">on GitHub</a>
|
98
|
-
|
99
|
-
</p>
|
100
|
-
<div id="M000012_source" class="dyn-source">
|
101
|
-
<pre><span class="ruby-comment cmt"># File lib/inochi/book.rb, line 82</span>
|
102
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">history</span>
|
103
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'block must be given'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
|
104
|
-
|
105
|
-
<span class="ruby-identifier">node</span> <span class="ruby-keyword kw">do</span>
|
106
|
-
<span class="ruby-identifier">$project_history_node</span> = <span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">last</span>
|
107
|
-
<span class="ruby-keyword kw">yield</span>
|
108
|
-
<span class="ruby-keyword kw">end</span>
|
109
|
-
<span class="ruby-keyword kw">end</span></pre>
|
110
|
-
</div>
|
111
|
-
</div>
|
112
|
-
|
113
|
-
</div>
|
114
|
-
|
115
|
-
<div class="method">
|
116
|
-
<div class="title" id="M000011">
|
117
|
-
|
118
|
-
<a name="M000011"></a><b>project</b>()
|
119
|
-
|
120
|
-
</div>
|
121
|
-
|
122
|
-
<div class="description">
|
123
|
-
<p>
|
124
|
-
Defines a brief summary of this project.
|
125
|
-
</p>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
<div class="sourcecode">
|
133
|
-
<p class="source-link">
|
134
|
-
Source: <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show</a>
|
135
|
-
|
136
|
-
| <a href="http://github.com/sunaku/inochi/blob/94ea085869f0eab9b04917d057bdae5b64157781/lib/inochi/book.rb#L70" target="_blank" class="github_url">on GitHub</a>
|
137
|
-
|
138
|
-
</p>
|
139
|
-
<div id="M000011_source" class="dyn-source">
|
140
|
-
<pre><span class="ruby-comment cmt"># File lib/inochi/book.rb, line 70</span>
|
141
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">project</span>
|
142
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'block must be given'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
|
143
|
-
|
144
|
-
<span class="ruby-identifier">node</span> <span class="ruby-keyword kw">do</span>
|
145
|
-
<span class="ruby-identifier">$project_summary_node</span> = <span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">last</span>
|
146
|
-
<span class="ruby-keyword kw">yield</span>
|
147
|
-
<span class="ruby-keyword kw">end</span>
|
148
|
-
<span class="ruby-keyword kw">end</span></pre>
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
|
152
|
-
</div>
|
153
|
-
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
</body>
|
157
|
-
</html>
|
@@ -1,331 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<title>Inochi::Phrases</title>
|
7
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
-
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
|
9
|
-
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
|
10
|
-
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
-
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
-
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
-
</head>
|
14
|
-
|
15
|
-
<body>
|
16
|
-
<div class="banner">
|
17
|
-
<h1>
|
18
|
-
<span class="type">Class</span>
|
19
|
-
Inochi::Phrases
|
20
|
-
|
21
|
-
<span class="parent"><
|
22
|
-
|
23
|
-
Object
|
24
|
-
|
25
|
-
</span>
|
26
|
-
|
27
|
-
</h1>
|
28
|
-
<ul class="files">
|
29
|
-
|
30
|
-
<li><a href="../../files/lib/inochi/init_rb.html">lib/inochi/init.rb</a></li>
|
31
|
-
|
32
|
-
</ul>
|
33
|
-
</div>
|
34
|
-
<div id="bodyContent">
|
35
|
-
<div id="content">
|
36
|
-
|
37
|
-
<div class="description">
|
38
|
-
<p>
|
39
|
-
Interface to translations of human text used in a project.
|
40
|
-
</p>
|
41
|
-
|
42
|
-
</div>
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<div class="sectiontitle">Methods</div>
|
53
|
-
<dl class="methods">
|
54
|
-
|
55
|
-
<dt>#</dt>
|
56
|
-
<dd>
|
57
|
-
<ul>
|
58
|
-
|
59
|
-
<li><a href="#M000029">[]</a></li>
|
60
|
-
|
61
|
-
</ul>
|
62
|
-
</dd>
|
63
|
-
|
64
|
-
<dt>L</dt>
|
65
|
-
<dd>
|
66
|
-
<ul>
|
67
|
-
|
68
|
-
<li><a href="#M000027">locale=</a></li>
|
69
|
-
|
70
|
-
</ul>
|
71
|
-
</dd>
|
72
|
-
|
73
|
-
<dt>M</dt>
|
74
|
-
<dd>
|
75
|
-
<ul>
|
76
|
-
|
77
|
-
<li><a href="#M000030">method_missing</a></li>
|
78
|
-
|
79
|
-
</ul>
|
80
|
-
</dd>
|
81
|
-
|
82
|
-
<dt>N</dt>
|
83
|
-
<dd>
|
84
|
-
<ul>
|
85
|
-
|
86
|
-
<li><a href="#M000026">new</a></li>
|
87
|
-
|
88
|
-
</ul>
|
89
|
-
</dd>
|
90
|
-
|
91
|
-
<dt>P</dt>
|
92
|
-
<dd>
|
93
|
-
<ul>
|
94
|
-
|
95
|
-
<li><a href="#M000028">phrases</a></li>
|
96
|
-
|
97
|
-
</ul>
|
98
|
-
</dd>
|
99
|
-
|
100
|
-
</dl>
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
<div class="sectiontitle">Attributes</div>
|
113
|
-
<table border='0' cellpadding='5'>
|
114
|
-
|
115
|
-
<tr valign='top'>
|
116
|
-
<td class='attr-rw'>
|
117
|
-
[R]
|
118
|
-
</td>
|
119
|
-
<td class='attr-name'>locale</td>
|
120
|
-
<td class='attr-desc'><p>
|
121
|
-
The locale into which the #[] method will translate phrases.
|
122
|
-
</p></td>
|
123
|
-
</tr>
|
124
|
-
|
125
|
-
</table>
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
<div class="sectiontitle">Class Public methods</div>
|
130
|
-
|
131
|
-
<div class="method">
|
132
|
-
<div class="title" id="M000026">
|
133
|
-
|
134
|
-
<a name="M000026"></a><b>new</b>(project_install_dir)
|
135
|
-
|
136
|
-
</div>
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
<div class="sourcecode">
|
142
|
-
<p class="source-link">
|
143
|
-
Source: <a href="javascript:toggleSource('M000026_source')" id="l_M000026_source">show</a>
|
144
|
-
|
145
|
-
| <a href="http://github.com/sunaku/inochi/blob/94ea085869f0eab9b04917d057bdae5b64157781/lib/inochi/init.rb#L175" target="_blank" class="github_url">on GitHub</a>
|
146
|
-
|
147
|
-
</p>
|
148
|
-
<div id="M000026_source" class="dyn-source">
|
149
|
-
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 175</span>
|
150
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">project_install_dir</span>
|
151
|
-
<span class="ruby-comment cmt"># load language translations dynamically</span>
|
152
|
-
<span class="ruby-identifier">lang_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">project_install_dir</span>, <span class="ruby-value str">'lang'</span>)
|
153
|
-
|
154
|
-
<span class="ruby-ivar">@phrases_by_language</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cache</span>, <span class="ruby-identifier">language</span><span class="ruby-operator">|</span>
|
155
|
-
<span class="ruby-comment cmt"># store the phrase upon failure so that</span>
|
156
|
-
<span class="ruby-comment cmt"># the phrases() method will know about it</span>
|
157
|
-
<span class="ruby-identifier">phrases</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-keyword kw">nil</span> }
|
158
|
-
|
159
|
-
<span class="ruby-identifier">lang_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">lang_dir</span>, <span class="ruby-node">"#{language}.yaml"</span>)
|
160
|
-
<span class="ruby-identifier">lang_data</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load_file</span>(<span class="ruby-identifier">lang_file</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
161
|
-
<span class="ruby-identifier">phrases</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">lang_data</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lang_data</span>
|
162
|
-
|
163
|
-
<span class="ruby-identifier">cache</span>[<span class="ruby-identifier">language</span>] = <span class="ruby-identifier">phrases</span>
|
164
|
-
<span class="ruby-keyword kw">end</span>
|
165
|
-
|
166
|
-
<span class="ruby-comment cmt"># detect user's preferred locale</span>
|
167
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">locale</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'LC_ALL'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'LC_MESSAGES'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'LANG'</span>]
|
168
|
-
<span class="ruby-keyword kw">end</span></pre>
|
169
|
-
</div>
|
170
|
-
</div>
|
171
|
-
|
172
|
-
</div>
|
173
|
-
|
174
|
-
<div class="sectiontitle">Instance Public methods</div>
|
175
|
-
|
176
|
-
<div class="method">
|
177
|
-
<div class="title" id="M000029">
|
178
|
-
|
179
|
-
<a name="M000029"></a><b>[]</b>(phrase, *words)
|
180
|
-
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="description">
|
184
|
-
<p>
|
185
|
-
Translates the given phrase into the target locale (see <a
|
186
|
-
href="Phrases.html#locale">locale</a> and <a
|
187
|
-
href="Phrases.html#M000027">locale=</a>) and then substitutes the given
|
188
|
-
placeholder arguments into the translation (see Kernel#sprintf).
|
189
|
-
</p>
|
190
|
-
<p>
|
191
|
-
If a translation is not available for the given phrase, then the given
|
192
|
-
phrase will be used as-is, untranslated.
|
193
|
-
</p>
|
194
|
-
|
195
|
-
</div>
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
<div class="sourcecode">
|
201
|
-
<p class="source-link">
|
202
|
-
Source: <a href="javascript:toggleSource('M000029_source')" id="l_M000029_source">show</a>
|
203
|
-
|
204
|
-
| <a href="http://github.com/sunaku/inochi/blob/94ea085869f0eab9b04917d057bdae5b64157781/lib/inochi/init.rb#L223" target="_blank" class="github_url">on GitHub</a>
|
205
|
-
|
206
|
-
</p>
|
207
|
-
<div id="M000029_source" class="dyn-source">
|
208
|
-
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 223</span>
|
209
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span> <span class="ruby-identifier">phrase</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">words</span>
|
210
|
-
<span class="ruby-identifier">translate</span> <span class="ruby-ivar">@language</span>, <span class="ruby-identifier">phrase</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">words</span>
|
211
|
-
<span class="ruby-keyword kw">end</span></pre>
|
212
|
-
</div>
|
213
|
-
</div>
|
214
|
-
|
215
|
-
</div>
|
216
|
-
|
217
|
-
<div class="method">
|
218
|
-
<div class="title" id="M000027">
|
219
|
-
|
220
|
-
<a name="M000027"></a><b>locale=</b>(locale)
|
221
|
-
|
222
|
-
</div>
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
<div class="sourcecode">
|
228
|
-
<p class="source-link">
|
229
|
-
Source: <a href="javascript:toggleSource('M000027_source')" id="l_M000027_source">show</a>
|
230
|
-
|
231
|
-
| <a href="http://github.com/sunaku/inochi/blob/94ea085869f0eab9b04917d057bdae5b64157781/lib/inochi/init.rb#L198" target="_blank" class="github_url">on GitHub</a>
|
232
|
-
|
233
|
-
</p>
|
234
|
-
<div id="M000027_source" class="dyn-source">
|
235
|
-
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 198</span>
|
236
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">locale=</span> <span class="ruby-identifier">locale</span>
|
237
|
-
<span class="ruby-ivar">@locale</span> = <span class="ruby-identifier">locale</span>.<span class="ruby-identifier">to_s</span>
|
238
|
-
|
239
|
-
<span class="ruby-comment cmt"># extract the language portion of the locale</span>
|
240
|
-
<span class="ruby-identifier">language</span> = <span class="ruby-ivar">@locale</span>[<span class="ruby-regexp re">/^[[:alpha:]]+/</span>].<span class="ruby-identifier">to_s</span>
|
241
|
-
<span class="ruby-ivar">@language</span> = <span class="ruby-identifier">language</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(C|POSIX)?$/i</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">:en</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">language</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">to_sym</span>
|
242
|
-
<span class="ruby-keyword kw">end</span></pre>
|
243
|
-
</div>
|
244
|
-
</div>
|
245
|
-
|
246
|
-
</div>
|
247
|
-
|
248
|
-
<div class="method">
|
249
|
-
<div class="title" id="M000030">
|
250
|
-
|
251
|
-
<a name="M000030"></a><b>method_missing</b>(meth, *args)
|
252
|
-
|
253
|
-
</div>
|
254
|
-
|
255
|
-
<div class="description">
|
256
|
-
<p>
|
257
|
-
Provides access to translations in any language, regardless of the target
|
258
|
-
locale (see <a href="Phrases.html#locale">locale</a> and <a
|
259
|
-
href="Phrases.html#M000027">locale=</a>).
|
260
|
-
</p>
|
261
|
-
<p>
|
262
|
-
For example, you can access Japanese translations via the jp method even if
|
263
|
-
the target locale is French.
|
264
|
-
</p>
|
265
|
-
|
266
|
-
</div>
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
<div class="sourcecode">
|
272
|
-
<p class="source-link">
|
273
|
-
Source: <a href="javascript:toggleSource('M000030_source')" id="l_M000030_source">show</a>
|
274
|
-
|
275
|
-
| <a href="http://github.com/sunaku/inochi/blob/94ea085869f0eab9b04917d057bdae5b64157781/lib/inochi/init.rb#L234" target="_blank" class="github_url">on GitHub</a>
|
276
|
-
|
277
|
-
</p>
|
278
|
-
<div id="M000030_source" class="dyn-source">
|
279
|
-
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 234</span>
|
280
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span> <span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
281
|
-
<span class="ruby-comment cmt"># ISO 639 language codes come in alpha-2 and alpha-3 forms</span>
|
282
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-z]{2,3}$/</span>
|
283
|
-
<span class="ruby-identifier">translate</span> <span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
284
|
-
<span class="ruby-keyword kw">else</span>
|
285
|
-
<span class="ruby-keyword kw">super</span>
|
286
|
-
<span class="ruby-keyword kw">end</span>
|
287
|
-
<span class="ruby-keyword kw">end</span></pre>
|
288
|
-
</div>
|
289
|
-
</div>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
|
293
|
-
<div class="method">
|
294
|
-
<div class="title" id="M000028">
|
295
|
-
|
296
|
-
<a name="M000028"></a><b>phrases</b>()
|
297
|
-
|
298
|
-
</div>
|
299
|
-
|
300
|
-
<div class="description">
|
301
|
-
<p>
|
302
|
-
Returns all phrases that underwent (or attempted) translation via this
|
303
|
-
object.
|
304
|
-
</p>
|
305
|
-
|
306
|
-
</div>
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
<div class="sourcecode">
|
312
|
-
<p class="source-link">
|
313
|
-
Source: <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show</a>
|
314
|
-
|
315
|
-
| <a href="http://github.com/sunaku/inochi/blob/94ea085869f0eab9b04917d057bdae5b64157781/lib/inochi/init.rb#L210" target="_blank" class="github_url">on GitHub</a>
|
316
|
-
|
317
|
-
</p>
|
318
|
-
<div id="M000028_source" class="dyn-source">
|
319
|
-
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 210</span>
|
320
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">phrases</span>
|
321
|
-
<span class="ruby-ivar">@phrases_by_language</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span> }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">sort</span>
|
322
|
-
<span class="ruby-keyword kw">end</span></pre>
|
323
|
-
</div>
|
324
|
-
</div>
|
325
|
-
|
326
|
-
</div>
|
327
|
-
|
328
|
-
</div>
|
329
|
-
</div>
|
330
|
-
</body>
|
331
|
-
</html>
|