This file is indexed.

/usr/share/doc/ruby-numru-units/units.html is in ruby-numru-units 1.9-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?xml version="1.0" ?>
<!DOCTYPE html 
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>units.rd</title>
</head>
<body>
<h1><a name="label-0" id="label-0">class NumRu::Units</a></h1><!-- RDLabel: "class NumRu::Units" -->
<ul>
<li><a href="#label-1">Overview</a></li>
<li><a href="#label-2">Installation</a></li>
<li><a href="#label-3">Usage Examples</a></li>
<li><a href="#label-4">Class Methods</a></li>
<li><a href="#label-8">Instance Methods</a></li>
<li><a href="http://ruby.gfd-dennou.org/products/numru-units/doc/dcunits.txt">Supported units</a>  (Plural form allowed if the second field is "P")</li>
</ul>
<h2><a name="label-1" id="label-1">Overview</a></h2><!-- RDLabel: "Overview" -->
<p>A class of units of physical quantities.</p>
<p>This class covers most functionality of UNIDATA's 
<a href="http://www.unidata.ucar.edu/packages/udunits/">UDUNITS Library</a>, 
however, with a more sophisticated handling of string expressions. </p>
<p>UDUNITS always decomposes units into the four base units and discards
the original string expressions. Therefore, 'hPa' always becomes
'100 kg.m-1.sec-1', and 'day' always becomes '86400 sec'. On the other 
hand, this library tries to keep the original expressions as much as
possible by default, while allowing partial to complete decompositions
if needed.</p>
<h2><a name="label-2" id="label-2">Installation</a></h2><!-- RDLabel: "Installation" -->
<p>Move to the top directly of this library (where you find
the file install.rb). Then, type in the following:</p>
<pre>% ruby install.rb</pre>
<h2><a name="label-3" id="label-3">Usage Examples</a></h2><!-- RDLabel: "Usage Examples" -->
<p>Here is an example using the "irb" interactive shell ("%" is the
command prompt, and "&gt;&gt;" is the irb prompt -- Type in those after it
to test.  "=&gt;" shows the result.):</p>
<pre>% irb --simple-prompt
&gt;&gt; require "numru/units"
=&gt; true
&gt;&gt; un1 = NumRu::Units.new('kg.m2/s')
=&gt; Units{kg.m2/s}
&gt;&gt; un2 = NumRu::Units.new('g.m')
=&gt; Units{g.m}
&gt;&gt; un3 = un1 / un2
=&gt; Units[Multi[Pow[Name[g], Number[-1]], Name[kg], Pow[Name[m], Number[1]], Pow[Name[s], Number[-1]]]]
&gt;&gt; un1.to_s
=&gt; "kg.m2/s"
&gt;&gt; un2.to_s
=&gt; "g.m"
&gt;&gt; un3.to_s
=&gt; "g-1 kg.m1 s-1"
&gt;&gt; un3.reduce5
=&gt; Units[Multi[Number[1000], Pow[Name[m], Number[1]], Pow[Name[s], Number[-1]]]]
&gt;&gt; un3.to_s
=&gt; "1000 m1 s-1"</pre>
<p>Note the difference between the results of un3.to_s 
before and after un3.reduce5,
where the former retains the literal expression
of each atomic unit, while the latter does the maximum reduction.
You can change the default behavior by using the class method 
reduce_level=:</p>
<pre>&gt;&gt; NumRu::Units.reduce_level = 5
=&gt; :reduce5
&gt;&gt; un3.to_s
=&gt; "1000 m1 s-1"</pre>
<p>Note that you can eliminate the prefix NumRu:: by "including"
it:</p>
<pre>&gt;&gt; require "numru/units"
=&gt; true
&gt;&gt; include NumRu
=&gt; Object
&gt;&gt; un1 = Units.new('kg.m2/s')
=&gt; Units{kg.m2/s}
&gt;&gt; Units.reduce_level = 5
=&gt; :reduce5</pre>
<h2><a name="label-4" id="label-4">Class Methods</a></h2><!-- RDLabel: "Class Methods" -->
<p>In what follows, the prefix NumRu:: is omitted for conciseness.
See <a href="#label-3">Usage Examples</a> on this issue.</p>
<dl>
<dt><h4><a name="label-5" id="label-5"><code>Units.new(<var>string</var>)</code></a></h4></dt><!-- RDLabel: "Units.new" -->
<dd>
<p>Constructor.</p>
<p>ARGUMENTS</p>
<ul>
<li>string (String): string expression of the units. 
      [factor] units; [factor] time units [since ...] (see EXAMPLES below)</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>a Units</li>
</ul>
<p>EXAMPLE</p>
<pre>units = Units.new('kg.m2/s')
units = Units.new('100 m')
units = Units.new('g/kg')
units = Units.new('hour since 2003-10-01 00:00:0 +0:00')
units = Units.new('hour since 2003-10-01')   # same as above
units = Units.new('minutes since 2003-10-01 03:15:22.5 -6:00')</pre></dd>
<dt><h4><a name="label-6" id="label-6"><code>Units[string]</code></a></h4></dt><!-- RDLabel: "Units[string]" -->
<dd>
Same as <a href="#label-5">Units.new</a></dd>
<dt><h4><a name="label-7" id="label-7"><code>Units.reduce_level=(<var>n</var>)</code></a></h4></dt><!-- RDLabel: "Units.reduce_level=" -->
<dd>
<p>Set the reduction level before <a href="#label-9">to_s</a> is applied.</p>
<p>ARGUMENTS</p>
<ul>
<li>n (Integer): the reduction level. The default value is 4.
      Use 5 if you want a full reduction. Levels lower than 4 
      will not be needed.</li>
</ul></dd>
</dl>
<h2><a name="label-8" id="label-8">Instance Methods</a></h2><!-- RDLabel: "Instance Methods" -->
<dl>
<dt><h4><a name="label-9" id="label-9"><code>to_s</code></a></h4></dt><!-- RDLabel: "to_s" -->
<dd>
Returns a string expression of the units.</dd>
<dt><h4><a name="label-10" id="label-10"><code>*(<var>other</var>)</code></a></h4></dt><!-- RDLabel: "*" -->
<dd>
<p>Multiplies self with another units. 
Applies <a href="#label-16">reduce4</a> to format the string expression of the result.</p>
<p>ARGUMENTS</p>
<ul>
<li>other [Units]: the other units</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>a Units</li>
</ul></dd>
<dt><h4><a name="label-11" id="label-11"><code>/(<var>other</var>)</code></a></h4></dt><!-- RDLabel: "/" -->
<dd>
<p>Divides self with another units.
Applies <a href="#label-16">reduce4</a> to format the string expression of the result.</p>
<p>ARGUMENTS</p>
<ul>
<li>other [Units]: the other units</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>a Units</li>
</ul></dd>
<dt><h4><a name="label-12" id="label-12"><code>**(<var>pow</var>)</code></a></h4></dt><!-- RDLabel: "**" -->
<dd>
<p>Power.
Applies <a href="#label-16">reduce4</a> to format the string expression of the result.</p>
<p>ARGUMENTS</p>
<ul>
<li>pow [Numeric -- Integer, Rational, or Float]</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>a Units</li>
</ul></dd>
<dt><h4><a name="label-13" id="label-13"><code>==(<var>other</var>)</code></a></h4></dt><!-- RDLabel: "==" -->
<dd>
Whether the two units are the same. 
('m/s' and 'm.s-1' are the same, for instance.)</dd>
<dt><h4><a name="label-14" id="label-14"><code>===(<var>other</var>)</code></a></h4></dt><!-- RDLabel: "===" -->
<dd>
Same as <a href="#label-13">==</a>.</dd>
<dt><h4><a name="label-15" id="label-15"><code>=~(<var>other</var>)</code></a></h4></dt><!-- RDLabel: "=~" -->
<dd>
Whether the two units are compatible (i.e., with the same dimensionality).
('m/s' and '10 m.s-1' are compatible, for instance.)</dd>
<dt><h4><a name="label-16" id="label-16"><code>reduce4</code></a></h4></dt><!-- RDLabel: "reduce4" -->
<dd>
<p>Moderately reduces the string expression of the units (destructive method).
This method preserves string expression of atomic units. 
See also <a href="#label-17">reduce5</a>.</p>
<p>RETURN VALUE</p>
<ul>
<li>self</li>
</ul>
<p>EXAMPLE</p>
<pre>Untis.new('hour/hour').reduce4.to_s
  # =&gt; "1"
Units.new('mm/m').reduce4.to_s
  # =&gt; "mm.m-1"</pre></dd>
<dt><h4><a name="label-17" id="label-17"><code>reduce5</code></a></h4></dt><!-- RDLabel: "reduce5" -->
<dd>
<p>Aggressively reduces the string expression of the units (destructive method).
See also <a href="#label-16">reduce4</a>.</p>
<p>RETURN VALUE</p>
<ul>
<li>self</li>
</ul>
<p>EXAMPLE</p>
<pre>Units.new('hour/hour').reduce4.to_s
  # =&gt; "1"
Units.new('mm/m').reduce5.to_s
  # =&gt; "0.001"</pre></dd>
<dt><h4><a name="label-18" id="label-18"><code>convert(<var>numeric</var>, <var>to_units</var>)</code></a></h4></dt><!-- RDLabel: "convert" -->
<dd>
<p>Converts a numeric of the current units (=self) to <var>to_units</var>.</p>
<p>ARGUMENTS</p>
<ul>
<li>numeric [Numeric]: the numeric to convert</li>
<li>to_units [Units]: the units converted into</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>a Numeric</li>
</ul>
<p>EXCEPTIONS</p>
<ul>
<li><var>self</var> and <var>to_units</var> are incompatible.</li>
</ul></dd>
<dt><h4><a name="label-19" id="label-19"><code>convert2(<var>val</var>, <var>to_units</var>)</code></a></h4></dt><!-- RDLabel: "convert2" -->
<dd>
<p>Like <a href="#label-18">convert</a>, but (1) accpets any Numeric-like objects, and (2)
does not raise an exception even if the two units are incompatible -- 
in this case, simply returns <var>val</var> (warned).</p>
<p>ARGUMENTS</p>
<ul>
<li>val [a Numeric-like class, for which * and + are defined]:
      the value to convert</li>
<li>to_units [Units]: the units converted into</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>an object with the same class as <var>val</var>.</li>
</ul></dd>
<dt><h4><a name="label-20" id="label-20"><code>factor_and_offset(<var>to_units</var>)</code></a></h4></dt><!-- RDLabel: "factor_and_offset" -->
<dd>
<p>Returns the factor and offset to convert from <var>self</var> to <var>to_units</var>.
The conversion is done as  scale_factor * operand + add_offset.</p>
<p>ARGUMENTS</p>
<ul>
<li>to_units [Units]: the units to be converted into</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>[ scale_factor, add_offset ] (a 2-element Array, where both are Numeric)</li>
</ul>
<p>EXAMPLE</p>
<pre>scale_factor, add_offset = from_units.factor_and_offset(to_units)
to = scale_factor * from + add_offset</pre></dd>
</dl>

</body>
</html>