term_utils 0.1.1 → 0.4.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.
- checksums.yaml +4 -4
- data/AUTHORS +1 -0
- data/CHANGELOG.md +51 -0
- data/COPYING +674 -0
- data/README.md +99 -0
- data/Rakefile +55 -0
- data/doc/TermUtils.html +138 -0
- data/doc/TermUtils/AP.html +394 -0
- data/doc/TermUtils/AP/Article.html +993 -0
- data/doc/TermUtils/AP/ArticleResult.html +584 -0
- data/doc/TermUtils/AP/Flag.html +756 -0
- data/doc/TermUtils/AP/NoSuchValueError.html +217 -0
- data/doc/TermUtils/AP/Parameter.html +1592 -0
- data/doc/TermUtils/AP/ParameterResult.html +980 -0
- data/doc/TermUtils/AP/ParameterWalkerHooks.html +409 -0
- data/doc/TermUtils/AP/ParseError.html +217 -0
- data/doc/TermUtils/AP/Parser.html +604 -0
- data/doc/TermUtils/AP/Result.html +837 -0
- data/doc/TermUtils/AP/Syntax.html +761 -0
- data/doc/TermUtils/AP/SyntaxError.html +217 -0
- data/doc/TermUtils/AP/Walker.html +686 -0
- data/doc/TermUtils/FF.html +128 -0
- data/doc/TermUtils/FF/Config.html +774 -0
- data/doc/TermUtils/FF/Context.html +585 -0
- data/doc/TermUtils/FF/Entry.html +626 -0
- data/doc/TermUtils/FF/Query.html +1085 -0
- data/doc/TermUtils/PropertyTreeNode.html +2113 -0
- data/doc/TermUtils/Tab.html +1486 -0
- data/doc/TermUtils/Tab/Column.html +1263 -0
- data/doc/TermUtils/Tab/Header.html +536 -0
- data/doc/TermUtils/Tab/Holder.html +1210 -0
- data/doc/TermUtils/Tab/Printer.html +967 -0
- data/doc/TermUtils/Tab/Table.html +1966 -0
- data/doc/TermUtils/Tab/TableError.html +217 -0
- data/doc/_index.html +387 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +170 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +170 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1539 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/term_utils.rb +11 -0
- data/lib/term_utils/ap.rb +70 -0
- data/lib/term_utils/ap/article.rb +74 -0
- data/lib/term_utils/ap/flag.rb +65 -0
- data/lib/term_utils/ap/parameter.rb +144 -0
- data/lib/term_utils/ap/parser.rb +211 -0
- data/lib/term_utils/ap/result.rb +244 -0
- data/lib/term_utils/ap/syntax.rb +96 -0
- data/lib/term_utils/ff.rb +27 -0
- data/lib/term_utils/ff/config.rb +55 -0
- data/lib/term_utils/ff/entry.rb +45 -0
- data/lib/term_utils/ff/query.rb +145 -0
- data/lib/term_utils/property_tree_node.rb +228 -0
- data/lib/term_utils/tab.rb +338 -88
- data/term_utils.gemspec +16 -0
- metadata +69 -7
data/README.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# term_utils
|
2
|
+
|
3
|
+
## Purpose
|
4
|
+
|
5
|
+
Provides utilities like argument parsing, table formatting and file finding.
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
Install term_utils at the command prompt:
|
10
|
+
|
11
|
+
gem install term_utils
|
12
|
+
|
13
|
+
Require term_utils in the source file:
|
14
|
+
|
15
|
+
require 'term_utils'
|
16
|
+
|
17
|
+
## Content
|
18
|
+
|
19
|
+
### Argument Parsing
|
20
|
+
|
21
|
+
Exmaple:
|
22
|
+
|
23
|
+
require 'term_utils/ap'
|
24
|
+
syntax = TermUtils::AP.create_syntax do |s|
|
25
|
+
s.define_parameter :limit do |p|
|
26
|
+
p.define_flag '-l'
|
27
|
+
p.define_article
|
28
|
+
end
|
29
|
+
s.define_parameter :path do |p|
|
30
|
+
p.max_occurs = nil
|
31
|
+
p.define_article
|
32
|
+
end
|
33
|
+
end
|
34
|
+
limit = nil
|
35
|
+
paths = []
|
36
|
+
TermUtils::AP.parse_arguments(syntax, ARGV) do |on|
|
37
|
+
on.parameter :limit do |p|
|
38
|
+
limit = p.value
|
39
|
+
end
|
40
|
+
on.parameter :path do |p|
|
41
|
+
paths << p.value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
puts "limit: #{limit}"
|
45
|
+
puts "paths:"
|
46
|
+
paths.each { |p| puts " #{p}" }
|
47
|
+
|
48
|
+
See the [manual](manual/ARGUMENT_PARSING.md) for more details.
|
49
|
+
|
50
|
+
### Table Formatting
|
51
|
+
|
52
|
+
Take the following table:
|
53
|
+
|
54
|
+
id string8 string16
|
55
|
+
---- -------- ----------------
|
56
|
+
1 Fiat Lux Fiat Lux
|
57
|
+
2 Alea ... Alea jacta est
|
58
|
+
3 Audac... Audaces fortuna juvat
|
59
|
+
---- -------- ----------------
|
60
|
+
id string8 string16
|
61
|
+
|
62
|
+
You can produce it with the following code:
|
63
|
+
|
64
|
+
require 'term_utils/tab'
|
65
|
+
|
66
|
+
TermUtils::Tab.define_table(:foo) do |t|
|
67
|
+
t.define_column :id, :width => 4, :align => :right
|
68
|
+
t.define_column :string8, :fixed => true, :ellipsis => "..."
|
69
|
+
t.define_column :string16, :width => 16
|
70
|
+
end
|
71
|
+
|
72
|
+
data = []
|
73
|
+
data << [1, "Fiat Lux", "Fiat Lux"]
|
74
|
+
data << [2, "Alea jacta est", "Alea jacta est"]
|
75
|
+
data << [3, "Audaces fortuna juvat", "Audaces fortuna juvat"]
|
76
|
+
|
77
|
+
TermUtils::Tab.printer :foo, $stdout, :offset => 2 do |tpr|
|
78
|
+
tpr.line
|
79
|
+
tpr.header
|
80
|
+
tpr.separator
|
81
|
+
data.each do |d|
|
82
|
+
tpr.data d
|
83
|
+
end
|
84
|
+
tpr.separator
|
85
|
+
tpr.header
|
86
|
+
tpr.line
|
87
|
+
end
|
88
|
+
|
89
|
+
### File Finding
|
90
|
+
|
91
|
+
The File Finding module provides a way to query the filesystem.
|
92
|
+
|
93
|
+
## Version History
|
94
|
+
|
95
|
+
[CHANGELOG](CHANGELOG.md)
|
96
|
+
|
97
|
+
## License
|
98
|
+
|
99
|
+
GPL-3.0-only.
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Rakefile for term_utils
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
GEM_SPEC = Gem::Specification::load("term_utils.gemspec")
|
6
|
+
GEM_NAME = GEM_SPEC.name
|
7
|
+
GEM_VERSION = GEM_SPEC.version
|
8
|
+
|
9
|
+
GEM = "#{GEM_NAME}-#{GEM_VERSION}.gem"
|
10
|
+
|
11
|
+
task :default => :help
|
12
|
+
|
13
|
+
task :help do
|
14
|
+
puts <<-EOS
|
15
|
+
usage: rake <target>...
|
16
|
+
|
17
|
+
Available targets:
|
18
|
+
doc Build doc.
|
19
|
+
gem Build gem.
|
20
|
+
clean Remove doc and gem.
|
21
|
+
install Install gem.
|
22
|
+
uninstall Uninstall gem.
|
23
|
+
|
24
|
+
To deploy a gem:
|
25
|
+
rm .doc
|
26
|
+
rake doc
|
27
|
+
rake gem
|
28
|
+
gem push #{GEM}
|
29
|
+
EOS
|
30
|
+
end
|
31
|
+
|
32
|
+
task :gem => GEM
|
33
|
+
|
34
|
+
task :doc => %w[.doc]
|
35
|
+
|
36
|
+
file ".doc" do
|
37
|
+
sh "yardoc"
|
38
|
+
sh "touch .doc"
|
39
|
+
end
|
40
|
+
|
41
|
+
file GEM => %w[.doc] do
|
42
|
+
sh "gem build #{GEM_NAME}"
|
43
|
+
end
|
44
|
+
|
45
|
+
task :install => :gem do
|
46
|
+
sh "gem install #{GEM}"
|
47
|
+
end
|
48
|
+
|
49
|
+
task :uninstall do
|
50
|
+
sh "gem uninstall #{GEM_NAME} --version #{GEM_VERSION}"
|
51
|
+
end
|
52
|
+
|
53
|
+
task :clean do
|
54
|
+
sh "rm -rf .doc doc #{GEM}"
|
55
|
+
end
|
data/doc/TermUtils.html
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: TermUtils
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.25
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "TermUtils";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (T)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">TermUtils</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: TermUtils
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/term_utils.rb<span class="defines">,<br />
|
82
|
+
lib/term_utils/ap.rb,<br /> lib/term_utils/ff.rb,<br /> lib/term_utils/tab.rb,<br /> lib/term_utils/ap/flag.rb,<br /> lib/term_utils/ff/entry.rb,<br /> lib/term_utils/ff/query.rb,<br /> lib/term_utils/ap/parser.rb,<br /> lib/term_utils/ap/result.rb,<br /> lib/term_utils/ap/syntax.rb,<br /> lib/term_utils/ff/config.rb,<br /> lib/term_utils/ap/article.rb,<br /> lib/term_utils/ap/parameter.rb,<br /> lib/term_utils/property_tree_node.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
89
|
+
<div class="discussion">
|
90
|
+
|
91
|
+
<p>Copyright (C) 2020 Thomas Baron</p>
|
92
|
+
|
93
|
+
<p>This file is part of term_utils.</p>
|
94
|
+
|
95
|
+
<p>term_utils is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.</p>
|
96
|
+
|
97
|
+
<p>term_utils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p>
|
98
|
+
|
99
|
+
<p>You should have received a copy of the GNU General Public License along with term_utils. If not, see <<a href="https://www.gnu.org/licenses">www.gnu.org/licenses</a>/>.</p>
|
100
|
+
|
101
|
+
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
<div class="tags">
|
105
|
+
|
106
|
+
|
107
|
+
</div><h2>Defined Under Namespace</h2>
|
108
|
+
<p class="children">
|
109
|
+
|
110
|
+
|
111
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="TermUtils/AP.html" title="TermUtils::AP (module)">AP</a></span>, <span class='object_link'><a href="TermUtils/FF.html" title="TermUtils::FF (module)">FF</a></span>, <span class='object_link'><a href="TermUtils/Tab.html" title="TermUtils::Tab (module)">Tab</a></span>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="TermUtils/PropertyTreeNode.html" title="TermUtils::PropertyTreeNode (class)">PropertyTreeNode</a></span>
|
116
|
+
|
117
|
+
|
118
|
+
</p>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div id="footer">
|
131
|
+
Generated on Sun Aug 2 18:35:09 2020 by
|
132
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
133
|
+
0.9.25 (ruby-2.6.5).
|
134
|
+
</div>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
</body>
|
138
|
+
</html>
|
@@ -0,0 +1,394 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: TermUtils::AP
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.25
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "TermUtils::AP";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (A)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">AP</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: TermUtils::AP
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/term_utils/ap.rb<span class="defines">,<br />
|
82
|
+
lib/term_utils/ap/flag.rb,<br /> lib/term_utils/ap/parser.rb,<br /> lib/term_utils/ap/result.rb,<br /> lib/term_utils/ap/syntax.rb,<br /> lib/term_utils/ap/article.rb,<br /> lib/term_utils/ap/parameter.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
89
|
+
<div class="discussion">
|
90
|
+
|
91
|
+
<p>The Argument Parser module provides a way to parse arguments.</p>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div class="tags">
|
97
|
+
|
98
|
+
|
99
|
+
</div><h2>Defined Under Namespace</h2>
|
100
|
+
<p class="children">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="AP/Article.html" title="TermUtils::AP::Article (class)">Article</a></span>, <span class='object_link'><a href="AP/ArticleResult.html" title="TermUtils::AP::ArticleResult (class)">ArticleResult</a></span>, <span class='object_link'><a href="AP/Flag.html" title="TermUtils::AP::Flag (class)">Flag</a></span>, <span class='object_link'><a href="AP/NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span>, <span class='object_link'><a href="AP/Parameter.html" title="TermUtils::AP::Parameter (class)">Parameter</a></span>, <span class='object_link'><a href="AP/ParameterResult.html" title="TermUtils::AP::ParameterResult (class)">ParameterResult</a></span>, <span class='object_link'><a href="AP/ParameterWalkerHooks.html" title="TermUtils::AP::ParameterWalkerHooks (class)">ParameterWalkerHooks</a></span>, <span class='object_link'><a href="AP/ParseError.html" title="TermUtils::AP::ParseError (class)">ParseError</a></span>, <span class='object_link'><a href="AP/Parser.html" title="TermUtils::AP::Parser (class)">Parser</a></span>, <span class='object_link'><a href="AP/Result.html" title="TermUtils::AP::Result (class)">Result</a></span>, <span class='object_link'><a href="AP/Syntax.html" title="TermUtils::AP::Syntax (class)">Syntax</a></span>, <span class='object_link'><a href="AP/SyntaxError.html" title="TermUtils::AP::SyntaxError (class)">SyntaxError</a></span>, <span class='object_link'><a href="AP/Walker.html" title="TermUtils::AP::Walker (class)">Walker</a></span>
|
106
|
+
|
107
|
+
|
108
|
+
</p>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<h2>
|
118
|
+
Class Method Summary
|
119
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
120
|
+
</h2>
|
121
|
+
|
122
|
+
<ul class="summary">
|
123
|
+
|
124
|
+
<li class="public ">
|
125
|
+
<span class="summary_signature">
|
126
|
+
|
127
|
+
<a href="#create_syntax-class_method" title="create_syntax (class method)">.<strong>create_syntax</strong>(&block) ⇒ TermUtils::AP::Syntax </a>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
</span>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<span class="summary_desc"><div class='inline'>
|
142
|
+
<p>Creates a new Syntax.</p>
|
143
|
+
</div></span>
|
144
|
+
|
145
|
+
</li>
|
146
|
+
|
147
|
+
|
148
|
+
<li class="public ">
|
149
|
+
<span class="summary_signature">
|
150
|
+
|
151
|
+
<a href="#parse_arguments-class_method" title="parse_arguments (class method)">.<strong>parse_arguments</strong>(syntax, arguments, opts = {}, &block) ⇒ Result </a>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
</span>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<span class="summary_desc"><div class='inline'>
|
166
|
+
<p>Parses a given list of arguments.</p>
|
167
|
+
</div></span>
|
168
|
+
|
169
|
+
</li>
|
170
|
+
|
171
|
+
|
172
|
+
</ul>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<div id="class_method_details" class="method_details_list">
|
178
|
+
<h2>Class Method Details</h2>
|
179
|
+
|
180
|
+
|
181
|
+
<div class="method_details first">
|
182
|
+
<h3 class="signature first" id="create_syntax-class_method">
|
183
|
+
|
184
|
+
.<strong>create_syntax</strong>(&block) ⇒ <tt><span class='object_link'><a href="AP/Syntax.html" title="TermUtils::AP::Syntax (class)">TermUtils::AP::Syntax</a></span></tt>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</h3><div class="docstring">
|
191
|
+
<div class="discussion">
|
192
|
+
|
193
|
+
<p>Creates a new Syntax.</p>
|
194
|
+
|
195
|
+
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
<div class="tags">
|
199
|
+
|
200
|
+
<p class="tag_title">Returns:</p>
|
201
|
+
<ul class="return">
|
202
|
+
|
203
|
+
<li>
|
204
|
+
|
205
|
+
|
206
|
+
<span class='type'>(<tt><span class='object_link'><a href="AP/Syntax.html" title="TermUtils::AP::Syntax (class)">TermUtils::AP::Syntax</a></span></tt>)</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</li>
|
211
|
+
|
212
|
+
</ul>
|
213
|
+
|
214
|
+
</div><table class="source_code">
|
215
|
+
<tr>
|
216
|
+
<td>
|
217
|
+
<pre class="lines">
|
218
|
+
|
219
|
+
|
220
|
+
45
|
221
|
+
46
|
222
|
+
47
|
223
|
+
48
|
224
|
+
49</pre>
|
225
|
+
</td>
|
226
|
+
<td>
|
227
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap.rb', line 45</span>
|
228
|
+
|
229
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_syntax'>create_syntax</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
230
|
+
<span class='id identifier rubyid_new_syntax'>new_syntax</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="TermUtils::AP (module)">AP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="AP/Syntax.html" title="TermUtils::AP::Syntax (class)">Syntax</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="AP/Syntax.html#initialize-instance_method" title="TermUtils::AP::Syntax#initialize (method)">new</a></span></span>
|
231
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_new_syntax'>new_syntax</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
|
232
|
+
<span class='id identifier rubyid_new_syntax'>new_syntax</span>
|
233
|
+
<span class='kw'>end</span></pre>
|
234
|
+
</td>
|
235
|
+
</tr>
|
236
|
+
</table>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="method_details ">
|
240
|
+
<h3 class="signature " id="parse_arguments-class_method">
|
241
|
+
|
242
|
+
.<strong>parse_arguments</strong>(syntax, arguments, opts = {}, &block) ⇒ <tt><span class='object_link'><a href="AP/Result.html" title="TermUtils::AP::Result (class)">Result</a></span></tt>
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</h3><div class="docstring">
|
249
|
+
<div class="discussion">
|
250
|
+
|
251
|
+
<p>Parses a given list of arguments.</p>
|
252
|
+
|
253
|
+
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
<div class="tags">
|
257
|
+
<p class="tag_title">Parameters:</p>
|
258
|
+
<ul class="param">
|
259
|
+
|
260
|
+
<li>
|
261
|
+
|
262
|
+
<span class='name'>syntax</span>
|
263
|
+
|
264
|
+
|
265
|
+
<span class='type'>(<tt><span class='object_link'><a href="AP/Syntax.html" title="TermUtils::AP::Syntax (class)">Syntax</a></span></tt>)</span>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
</li>
|
270
|
+
|
271
|
+
<li>
|
272
|
+
|
273
|
+
<span class='name'>arguments</span>
|
274
|
+
|
275
|
+
|
276
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</li>
|
281
|
+
|
282
|
+
<li>
|
283
|
+
|
284
|
+
<span class='name'>opts</span>
|
285
|
+
|
286
|
+
|
287
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
288
|
+
|
289
|
+
|
290
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
291
|
+
|
292
|
+
|
293
|
+
</li>
|
294
|
+
|
295
|
+
</ul>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
305
|
+
<ul class="option">
|
306
|
+
|
307
|
+
<li>
|
308
|
+
<span class="name">:strict</span>
|
309
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
310
|
+
<span class="default">
|
311
|
+
|
312
|
+
</span>
|
313
|
+
|
314
|
+
— <div class='inline'>
|
315
|
+
<p>Whether the Syntax must be considered strict.</p>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
</li>
|
319
|
+
|
320
|
+
</ul>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
<p class="tag_title">Returns:</p>
|
326
|
+
<ul class="return">
|
327
|
+
|
328
|
+
<li>
|
329
|
+
|
330
|
+
|
331
|
+
<span class='type'>(<tt><span class='object_link'><a href="AP/Result.html" title="TermUtils::AP::Result (class)">Result</a></span></tt>)</span>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
</li>
|
336
|
+
|
337
|
+
</ul>
|
338
|
+
<p class="tag_title">Raises:</p>
|
339
|
+
<ul class="raise">
|
340
|
+
|
341
|
+
<li>
|
342
|
+
|
343
|
+
|
344
|
+
<span class='type'>(<tt><span class='object_link'><a href="AP/ParseError.html" title="TermUtils::AP::ParseError (class)">ParseError</a></span></tt>)</span>
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
</li>
|
349
|
+
|
350
|
+
<li>
|
351
|
+
|
352
|
+
|
353
|
+
<span class='type'>(<tt><span class='object_link'><a href="AP/SyntaxError.html" title="TermUtils::AP::SyntaxError (class)">SyntaxError</a></span></tt>)</span>
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
</li>
|
358
|
+
|
359
|
+
</ul>
|
360
|
+
|
361
|
+
</div><table class="source_code">
|
362
|
+
<tr>
|
363
|
+
<td>
|
364
|
+
<pre class="lines">
|
365
|
+
|
366
|
+
|
367
|
+
59
|
368
|
+
60
|
369
|
+
61</pre>
|
370
|
+
</td>
|
371
|
+
<td>
|
372
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap.rb', line 59</span>
|
373
|
+
|
374
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse_arguments'>parse_arguments</span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
375
|
+
<span class='const'><span class='object_link'><a href="../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="TermUtils::AP (module)">AP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="AP/Parser.html" title="TermUtils::AP::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="AP/Parser.html#initialize-instance_method" title="TermUtils::AP::Parser#initialize (method)">new</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse_arguments'><span class='object_link'><a href="AP/Parser.html#parse_arguments-instance_method" title="TermUtils::AP::Parser#parse_arguments (method)">parse_arguments</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
376
|
+
<span class='kw'>end</span></pre>
|
377
|
+
</td>
|
378
|
+
</tr>
|
379
|
+
</table>
|
380
|
+
</div>
|
381
|
+
|
382
|
+
</div>
|
383
|
+
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div id="footer">
|
387
|
+
Generated on Sun Aug 2 18:35:09 2020 by
|
388
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
389
|
+
0.9.25 (ruby-2.6.5).
|
390
|
+
</div>
|
391
|
+
|
392
|
+
</div>
|
393
|
+
</body>
|
394
|
+
</html>
|