print_primes_table 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +3 -0
- data/.yardoc/checksums +10 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +22 -0
- data/README.md +78 -0
- data/Rakefile +2 -0
- data/bin/print_primes_table +10 -0
- data/doc/PrintPrimesTable.html +146 -0
- data/doc/PrintPrimesTable/Client.html +368 -0
- data/doc/PrintPrimesTable/Options.html +142 -0
- data/doc/PrintPrimesTable/Options/DefaultOption.html +247 -0
- data/doc/PrintPrimesTable/Options/HelpOption.html +311 -0
- data/doc/PrintPrimesTable/Options/OnlyPrimesOption.html +289 -0
- data/doc/PrintPrimesTable/Primes.html +496 -0
- data/doc/PrintPrimesTable/Validators.html +142 -0
- data/doc/PrintPrimesTable/Validators/DefaultValidator.html +284 -0
- data/doc/PrintPrimesTable/Validators/ErrorMessage.html +405 -0
- data/doc/PrintPrimesTable/Validators/HelpValidator.html +285 -0
- data/doc/_index.html +228 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +122 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +122 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +135 -0
- data/doc/top-level-namespace.html +131 -0
- data/features/command_print_primes_table.feature +57 -0
- data/features/help_option.feature +24 -0
- data/features/support/env.rb +2 -0
- data/features/validate_arguments.feature +14 -0
- data/lib/print_primes_table.rb +4 -0
- data/lib/print_primes_table/client.rb +40 -0
- data/lib/print_primes_table/options/default_option.rb +28 -0
- data/lib/print_primes_table/options/help_option.rb +47 -0
- data/lib/print_primes_table/options/only_primes_option.rb +29 -0
- data/lib/print_primes_table/primes.rb +52 -0
- data/lib/print_primes_table/validators/default_validator.rb +39 -0
- data/lib/print_primes_table/validators/error_message.rb +31 -0
- data/lib/print_primes_table/validators/help_validator.rb +28 -0
- data/lib/print_primes_table/version.rb +10 -0
- data/print_primes_table.gemspec +29 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0be566f356becd5cc6fdd78afe8a2925af1239bb
|
4
|
+
data.tar.gz: 8ba4c88f4eaf630fb34b6dada66dcabb4cbb3689
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5a1fecc06a35645762f9b5042b2e9d7631b53792b0c5eb97e6e6205e7437c940ee9a5dd24118afa4fa2970aa3361022452db3cccc534fd3dc68459a023cb76de
|
7
|
+
data.tar.gz: 5a965442982e2621f5a20f3da20ff33a899084d1f3af8e490c992f445c4272c70bec64728cd9276ef9d3e0470bb083ae863d0ee25cf2367277e6c85e6c7e1f52
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/.yardoc/checksums
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
lib/print_primes_table.rb 096ba3f5c6b4085d5b033b05ca6c027bfa02fcfe
|
2
|
+
lib/print_primes_table/primes.rb 316cb137b67631d0fd5b0903f3dcd89683b33406
|
3
|
+
lib/print_primes_table/client.rb feb4ed4f393942128f435645bbf689585be732a8
|
4
|
+
lib/print_primes_table/version.rb c69f6b9740460fe253b74bc6b31633c64d6045ba
|
5
|
+
lib/print_primes_table/options/help_option.rb 6763ec0f0af6926d2a2602383058f6b75ec4cd6c
|
6
|
+
lib/print_primes_table/options/default_option.rb ba085e48f1a68d400641ecafb6096547688683b9
|
7
|
+
lib/print_primes_table/validators/error_message.rb 34c3533db07a281de69e702a7d9ed4ecd8660ea9
|
8
|
+
lib/print_primes_table/validators/help_validator.rb b3b98204ba8e08f64a517fdf16b29d45bf7f8f29
|
9
|
+
lib/print_primes_table/options/only_primes_option.rb c748cc2519197a071f342cf7797d0fc6ab086b89
|
10
|
+
lib/print_primes_table/validators/default_validator.rb c14d35f069008c9c4ccb50a15d4e47b3a1977cc3
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in print_primes_table.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'terminal-table'
|
7
|
+
gem 'yard'
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem 'shoulda-matchers'
|
11
|
+
gem 'cucumber'
|
12
|
+
gem 'rspec-expectations'
|
13
|
+
gem 'aruba'
|
14
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Diego H Piccinini Lagos
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# PrintPrimesTable
|
2
|
+
|
3
|
+
This program prints out a multiplication table of the first 10 prime numbers.
|
4
|
+
|
5
|
+
The program run from a command line and print to screen one table.
|
6
|
+
Across the top and down the left side should be the 10 primes, and the body of the table should contain the product of multiplying these numbers.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'print_primes_table'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install print_primes_table
|
23
|
+
|
24
|
+
## Ruby version
|
25
|
+
2.0+
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Type in your terminal console:
|
30
|
+
|
31
|
+
```bash
|
32
|
+
|
33
|
+
print_primes_table --help
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
+---------------+----------------------------------------------------------+
|
38
|
+
| Option | Description |
|
39
|
+
+---------------+----------------------------------------------------------+
|
40
|
+
| default | Print a table across the top and down the left |
|
41
|
+
| | side are the 10 primes, and the body of the table |
|
42
|
+
| without | should contain the product of multiplying these numbers. |
|
43
|
+
| option | This option accept one param the quantity. |
|
44
|
+
| | For example, if you want to print 20 type this |
|
45
|
+
| | print_table_primes 20 |
|
46
|
+
| | |
|
47
|
+
| --only-primes | Print a list of 10 primes. |
|
48
|
+
| | This option accept one param the quantity. |
|
49
|
+
| | For example, if you want to print 20 type this |
|
50
|
+
| | print_table_primes --only-primes 20 |
|
51
|
+
| | |
|
52
|
+
| --only-primes | Print this help. |
|
53
|
+
+---------------+----------------------------------------------------------+
|
54
|
+
|
55
|
+
without options you should have this response:
|
56
|
+
|
57
|
+
+----+----+----+-----+-----+-----+-----+-----+-----+-----+-----+
|
58
|
+
| | 2 | 3 | 5 | 7 | 11 | 13 | 17 | 19 | 23 | 29 |
|
59
|
+
+----+----+----+-----+-----+-----+-----+-----+-----+-----+-----+
|
60
|
+
| 2 | 4 | 6 | 10 | 14 | 22 | 26 | 34 | 38 | 46 | 58 |
|
61
|
+
| 3 | 6 | 9 | 15 | 21 | 33 | 39 | 51 | 57 | 69 | 87 |
|
62
|
+
| 5 | 10 | 15 | 25 | 35 | 55 | 65 | 85 | 95 | 115 | 145 |
|
63
|
+
| 7 | 14 | 21 | 35 | 49 | 77 | 91 | 119 | 133 | 161 | 203 |
|
64
|
+
| 11 | 22 | 33 | 55 | 77 | 121 | 143 | 187 | 209 | 253 | 319 |
|
65
|
+
| 13 | 26 | 39 | 65 | 91 | 143 | 169 | 221 | 247 | 299 | 377 |
|
66
|
+
| 17 | 34 | 51 | 85 | 119 | 187 | 221 | 289 | 323 | 391 | 493 |
|
67
|
+
| 19 | 38 | 57 | 95 | 133 | 209 | 247 | 323 | 361 | 437 | 551 |
|
68
|
+
| 23 | 46 | 69 | 115 | 161 | 253 | 299 | 391 | 437 | 529 | 667 |
|
69
|
+
| 29 | 58 | 87 | 145 | 203 | 319 | 377 | 493 | 551 | 667 | 841 |
|
70
|
+
+----+----+----+-----+-----+-----+-----+-----+-----+-----+-----+
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
1. Fork it ( https://github.com/diegopiccinini/print_primes_table/fork )
|
75
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
76
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
77
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
78
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: PrintPrimesTable
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!PrintPrimesTable.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (P)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">PrintPrimesTable</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: PrintPrimesTable
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/print_primes_table/primes.rb<span class="defines">,<br />
|
83
|
+
lib/print_primes_table/client.rb,<br /> lib/print_primes_table/version.rb,<br /> lib/print_primes_table/options/help_option.rb,<br /> lib/print_primes_table/options/default_option.rb,<br /> lib/print_primes_table/validators/error_message.rb,<br /> lib/print_primes_table/validators/help_validator.rb,<br /> lib/print_primes_table/options/only_primes_option.rb,<br /> lib/print_primes_table/validators/default_validator.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Defined Under Namespace</h2>
|
90
|
+
<p class="children">
|
91
|
+
|
92
|
+
|
93
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="PrintPrimesTable/Options.html" title="PrintPrimesTable::Options (module)">Options</a></span>, <span class='object_link'><a href="PrintPrimesTable/Validators.html" title="PrintPrimesTable::Validators (module)">Validators</a></span>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="PrintPrimesTable/Client.html" title="PrintPrimesTable::Client (class)">Client</a></span>, <span class='object_link'><a href="PrintPrimesTable/Primes.html" title="PrintPrimesTable::Primes (class)">Primes</a></span>
|
98
|
+
|
99
|
+
|
100
|
+
</p>
|
101
|
+
|
102
|
+
<h2>Constant Summary</h2>
|
103
|
+
|
104
|
+
<dl class="constants">
|
105
|
+
|
106
|
+
<dt id="VERSION-constant" class="">VERSION =
|
107
|
+
|
108
|
+
</dt>
|
109
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.2</span><span class='tstring_end'>"</span></span></pre></dd>
|
110
|
+
|
111
|
+
<dt id="OPTIONS-constant" class="">OPTIONS =
|
112
|
+
|
113
|
+
</dt>
|
114
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--only-primes</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--help</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span></pre></dd>
|
115
|
+
|
116
|
+
<dt id="DEFAULT_TOTAL-constant" class="">DEFAULT_TOTAL =
|
117
|
+
|
118
|
+
</dt>
|
119
|
+
<dd><pre class="code"><span class='int'>10</span></pre></dd>
|
120
|
+
|
121
|
+
<dt id="DEFAULT_START-constant" class="">DEFAULT_START =
|
122
|
+
|
123
|
+
</dt>
|
124
|
+
<dd><pre class="code"><span class='int'>2</span></pre></dd>
|
125
|
+
|
126
|
+
</dl>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div id="footer">
|
140
|
+
Generated on Thu Apr 9 11:19:34 2015 by
|
141
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
142
|
+
0.8.7.6 (ruby-2.0.0).
|
143
|
+
</div>
|
144
|
+
|
145
|
+
</body>
|
146
|
+
</html>
|
@@ -0,0 +1,368 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: PrintPrimesTable::Client
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!PrintPrimesTable/Client.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../PrintPrimesTable.html" title="PrintPrimesTable (module)">PrintPrimesTable</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Client</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: PrintPrimesTable::Client
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">PrintPrimesTable::Client</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/print_primes_table/client.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
<div class="tags">
|
109
|
+
|
110
|
+
<p class="tag_title">Author:</p>
|
111
|
+
<ul class="author">
|
112
|
+
|
113
|
+
<li>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<div class='inline'>
|
120
|
+
<p>Diego Hernán Piccinini Lagos</p>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
</li>
|
124
|
+
|
125
|
+
</ul>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<h2>
|
136
|
+
Class Method Summary
|
137
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
138
|
+
</h2>
|
139
|
+
|
140
|
+
<ul class="summary">
|
141
|
+
|
142
|
+
<li class="public ">
|
143
|
+
<span class="summary_signature">
|
144
|
+
|
145
|
+
<a href="#get_command-class_method" title="get_command (class method)">+ (Object) <strong>get_command</strong> </a>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
</span>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<span class="summary_desc"><div class='inline'>
|
160
|
+
<p>capture command arguments and options.</p>
|
161
|
+
</div></span>
|
162
|
+
|
163
|
+
</li>
|
164
|
+
|
165
|
+
|
166
|
+
<li class="public ">
|
167
|
+
<span class="summary_signature">
|
168
|
+
|
169
|
+
<a href="#process_command-class_method" title="process_command (class method)">+ (Object) <strong>process_command</strong>(args, options) </a>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
</span>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<span class="summary_desc"><div class='inline'>
|
184
|
+
<p>when the command has options, the option is executed when there isn't
|
185
|
+
options execute the default option I think in future is possible to include
|
186
|
+
more in the same instruction.</p>
|
187
|
+
</div></span>
|
188
|
+
|
189
|
+
</li>
|
190
|
+
|
191
|
+
|
192
|
+
</ul>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<div id="class_method_details" class="method_details_list">
|
198
|
+
<h2>Class Method Details</h2>
|
199
|
+
|
200
|
+
|
201
|
+
<div class="method_details first">
|
202
|
+
<h3 class="signature first" id="get_command-class_method">
|
203
|
+
|
204
|
+
+ (<tt>Object</tt>) <strong>get_command</strong>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</h3><div class="docstring">
|
211
|
+
<div class="discussion">
|
212
|
+
|
213
|
+
<p>capture command arguments and options</p>
|
214
|
+
|
215
|
+
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
<div class="tags">
|
219
|
+
|
220
|
+
|
221
|
+
</div><table class="source_code">
|
222
|
+
<tr>
|
223
|
+
<td>
|
224
|
+
<pre class="lines">
|
225
|
+
|
226
|
+
|
227
|
+
8
|
228
|
+
9
|
229
|
+
10
|
230
|
+
11
|
231
|
+
12
|
232
|
+
13
|
233
|
+
14
|
234
|
+
15
|
235
|
+
16
|
236
|
+
17
|
237
|
+
18</pre>
|
238
|
+
</td>
|
239
|
+
<td>
|
240
|
+
<pre class="code"><span class="info file"># File 'lib/print_primes_table/client.rb', line 8</span>
|
241
|
+
|
242
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_command'>get_command</span>
|
243
|
+
<span class='kw'>begin</span>
|
244
|
+
|
245
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='const'>OPTIONS</span> <span class='op'>&</span> <span class='const'>ARGV</span>
|
246
|
+
<span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='const'>ARGV</span> <span class='op'>-</span> <span class='id identifier rubyid_options'>options</span>
|
247
|
+
<span class='id identifier rubyid_process_command'>process_command</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
248
|
+
|
249
|
+
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_err'>err</span>
|
250
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_err'>err</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
251
|
+
<span class='kw'>end</span>
|
252
|
+
<span class='kw'>end</span></pre>
|
253
|
+
</td>
|
254
|
+
</tr>
|
255
|
+
</table>
|
256
|
+
</div>
|
257
|
+
|
258
|
+
<div class="method_details ">
|
259
|
+
<h3 class="signature " id="process_command-class_method">
|
260
|
+
|
261
|
+
+ (<tt>Object</tt>) <strong>process_command</strong>(args, options)
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
</h3><div class="docstring">
|
268
|
+
<div class="discussion">
|
269
|
+
|
270
|
+
<p>when the command has options, the option is executed when there isn't
|
271
|
+
options execute the default option I think in future is possible to include
|
272
|
+
more in the same instruction</p>
|
273
|
+
|
274
|
+
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
<div class="tags">
|
278
|
+
<p class="tag_title">Parameters:</p>
|
279
|
+
<ul class="param">
|
280
|
+
|
281
|
+
<li>
|
282
|
+
|
283
|
+
<span class='name'>args</span>
|
284
|
+
|
285
|
+
|
286
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
—
|
291
|
+
<div class='inline'>
|
292
|
+
<p>arguments captured in a console standard input</p>
|
293
|
+
</div>
|
294
|
+
|
295
|
+
</li>
|
296
|
+
|
297
|
+
<li>
|
298
|
+
|
299
|
+
<span class='name'>options</span>
|
300
|
+
|
301
|
+
|
302
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
—
|
307
|
+
<div class='inline'>
|
308
|
+
<p>the program is prepared to get one option but in</p>
|
309
|
+
</div>
|
310
|
+
|
311
|
+
</li>
|
312
|
+
|
313
|
+
</ul>
|
314
|
+
|
315
|
+
|
316
|
+
</div><table class="source_code">
|
317
|
+
<tr>
|
318
|
+
<td>
|
319
|
+
<pre class="lines">
|
320
|
+
|
321
|
+
|
322
|
+
25
|
323
|
+
26
|
324
|
+
27
|
325
|
+
28
|
326
|
+
29
|
327
|
+
30
|
328
|
+
31
|
329
|
+
32
|
330
|
+
33
|
331
|
+
34
|
332
|
+
35
|
333
|
+
36
|
334
|
+
37</pre>
|
335
|
+
</td>
|
336
|
+
<td>
|
337
|
+
<pre class="code"><span class="info file"># File 'lib/print_primes_table/client.rb', line 25</span>
|
338
|
+
|
339
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_command'>process_command</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
340
|
+
|
341
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='op'>|</span>
|
342
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_option'>option</span>
|
343
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--only-primes</span><span class='tstring_end'>'</span></span>
|
344
|
+
<span class='const'>Options</span><span class='op'>::</span><span class='const'>OnlyPrimesOption</span><span class='period'>.</span><span class='id identifier rubyid_process'>process</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
345
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--help</span><span class='tstring_end'>'</span></span>
|
346
|
+
<span class='const'>Options</span><span class='op'>::</span><span class='const'>HelpOption</span><span class='period'>.</span><span class='id identifier rubyid_process'>process</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
347
|
+
<span class='kw'>end</span>
|
348
|
+
<span class='kw'>end</span>
|
349
|
+
<span class='const'>Options</span><span class='op'>::</span><span class='const'>DefaultOption</span><span class='period'>.</span><span class='id identifier rubyid_process'>process</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'><</span> <span class='int'>1</span>
|
350
|
+
|
351
|
+
<span class='kw'>end</span></pre>
|
352
|
+
</td>
|
353
|
+
</tr>
|
354
|
+
</table>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
</div>
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<div id="footer">
|
362
|
+
Generated on Thu Apr 9 11:19:34 2015 by
|
363
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
364
|
+
0.8.7.6 (ruby-2.0.0).
|
365
|
+
</div>
|
366
|
+
|
367
|
+
</body>
|
368
|
+
</html>
|