gravaty 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gravaty might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/CHANGELOG +587 -0
- data/COPYING.md +234 -0
- data/Gemfile +17 -0
- data/ISSUES.md +40 -0
- data/README.md +128 -0
- data/Rakefile +48 -0
- data/acknowledgements.md +40 -0
- data/authors.md +44 -0
- data/copyright.md +339 -0
- data/examples/avatar.rb +121 -0
- data/examples/basics.rb +60 -0
- data/examples/profile.rb +143 -0
- data/examples/xmlrpc.rb +33 -0
- data/gravaty.gemspec +59 -0
- data/gravaty.odp +0 -0
- data/gravaty.pdf +0 -0
- data/html/CHANGELOG.html +876 -0
- data/html/COPYING_md.html +803 -0
- data/html/Gemfile.html +114 -0
- data/html/Gravaty.html +322 -0
- data/html/Gravaty/Gravaty.html +997 -0
- data/html/Gravaty/ParsableDuckType.html +158 -0
- data/html/Gravaty/Parser.html +233 -0
- data/html/Gravaty/Parsers.html +94 -0
- data/html/Gravaty/Parsers/Avatar.html +166 -0
- data/html/Gravaty/Parsers/Callback.html +167 -0
- data/html/Gravaty/Parsers/Default.html +174 -0
- data/html/Gravaty/Parsers/Force.html +167 -0
- data/html/Gravaty/Parsers/Format.html +177 -0
- data/html/Gravaty/Parsers/Pixelsize.html +177 -0
- data/html/Gravaty/Parsers/Rating.html +177 -0
- data/html/Gravaty/Parsers/Secure.html +166 -0
- data/html/Gravaty/Parsers/Type.html +177 -0
- data/html/Gravaty/Utils.html +107 -0
- data/html/Gravaty/Utils/Downloader.html +106 -0
- data/html/Gravaty/Utils/Downloader/Downloader.html +224 -0
- data/html/Gravaty/Utils/Raisers.html +199 -0
- data/html/Gravaty/Utils/Rfc5322.html +149 -0
- data/html/Gravaty/Utils/RpcConnector.html +106 -0
- data/html/Gravaty/Utils/RpcConnector/RpcConnector.html +241 -0
- data/html/ISSUES_md.html +165 -0
- data/html/Object.html +183 -0
- data/html/README_md.html +436 -0
- data/html/Rakefile.html +152 -0
- data/html/acknowledgements_md.html +172 -0
- data/html/authors_md.html +178 -0
- data/html/copyright_md.html +553 -0
- data/html/created.rid +59 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +590 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/gravaty_gemspec.html +162 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +467 -0
- data/html/js/darkfish.js +161 -0
- data/html/js/jquery.js +4 -0
- data/html/js/navigation.js +142 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +479 -0
- data/lib/gravaty.rb +59 -0
- data/lib/gravaty/application.rb +272 -0
- data/lib/gravaty/constants.rb +53 -0
- data/lib/gravaty/locales/en.yml +34 -0
- data/lib/gravaty/locales/it.yml +34 -0
- data/lib/gravaty/locales/ja.yml +35 -0
- data/lib/gravaty/parser.rb +41 -0
- data/lib/gravaty/parsers/avatar.rb +33 -0
- data/lib/gravaty/parsers/callback.rb +34 -0
- data/lib/gravaty/parsers/default.rb +79 -0
- data/lib/gravaty/parsers/force.rb +33 -0
- data/lib/gravaty/parsers/format.rb +38 -0
- data/lib/gravaty/parsers/pixelsize.rb +38 -0
- data/lib/gravaty/parsers/rating.rb +38 -0
- data/lib/gravaty/parsers/secure.rb +32 -0
- data/lib/gravaty/parsers/type.rb +38 -0
- data/lib/gravaty/utils/downloader.rb +150 -0
- data/lib/gravaty/utils/raisers.rb +50 -0
- data/lib/gravaty/utils/rfc5322.rb +102 -0
- data/lib/gravaty/utils/rpc_connector.rb +71 -0
- data/lib/gravaty/version.rb +20 -0
- data/test/gravaty/locales/test_locales.rb +61 -0
- data/test/gravaty/parsers/test_avatar.rb +35 -0
- data/test/gravaty/parsers/test_callback.rb +37 -0
- data/test/gravaty/parsers/test_default.rb +69 -0
- data/test/gravaty/parsers/test_force.rb +35 -0
- data/test/gravaty/parsers/test_format.rb +48 -0
- data/test/gravaty/parsers/test_pixelsize.rb +50 -0
- data/test/gravaty/parsers/test_rating.rb +48 -0
- data/test/gravaty/parsers/test_secure.rb +35 -0
- data/test/gravaty/parsers/test_type.rb +37 -0
- data/test/gravaty/test_application.rb +111 -0
- data/test/gravaty/test_avatar.rb +115 -0
- data/test/gravaty/test_parsable_duck_type.rb +31 -0
- data/test/gravaty/test_parser.rb +55 -0
- data/test/gravaty/test_profile.rb +63 -0
- data/test/gravaty/utils/test_downloader.rb +43 -0
- data/test/gravaty/utils/test_raisers.rb +55 -0
- data/test/gravaty/utils/test_rfc5322.rb +58 -0
- data/test/gravaty/utils/test_rpc_connector.rb +74 -0
- data/test/test_gravaty.rb +44 -0
- data/test/test_helper.rb +77 -0
- metadata +315 -0
@@ -0,0 +1,166 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Gravaty::Parsers::Avatar - gravaty 8.0.0</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../";
|
11
|
+
var index_rel_prefix = "../../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../../js/jquery.js"></script>
|
15
|
+
<script src="../../js/darkfish.js"></script>
|
16
|
+
|
17
|
+
<link href="../../css/fonts.css" rel="stylesheet">
|
18
|
+
<link href="../../css/rdoc.css" rel="stylesheet">
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
<body id="top" role="document" class="class">
|
23
|
+
<nav role="navigation">
|
24
|
+
<div id="project-navigation">
|
25
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
26
|
+
<h2>
|
27
|
+
<a href="../../index.html" rel="home">Home</a>
|
28
|
+
</h2>
|
29
|
+
|
30
|
+
<div id="table-of-contents-navigation">
|
31
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
32
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
33
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
38
|
+
<form action="#" method="get" accept-charset="utf-8">
|
39
|
+
<div id="search-field-wrapper">
|
40
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
41
|
+
aria-autocomplete="list" aria-controls="search-results"
|
42
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
43
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<ul id="search-results" aria-label="Search Results"
|
47
|
+
aria-busy="false" aria-expanded="false"
|
48
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
49
|
+
</form>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
<div id="class-metadata">
|
57
|
+
|
58
|
+
<div id="parent-class-section" class="nav-section">
|
59
|
+
<h3>Parent</h3>
|
60
|
+
|
61
|
+
|
62
|
+
<p class="link"><a href="../../Object.html">Object</a>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
<!-- Method Quickref -->
|
69
|
+
<div id="method-list-section" class="nav-section">
|
70
|
+
<h3>Methods</h3>
|
71
|
+
|
72
|
+
<ul class="link-list" role="directory">
|
73
|
+
|
74
|
+
<li ><a href="#method-i-parse">#parse</a>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
</div>
|
80
|
+
</nav>
|
81
|
+
|
82
|
+
<main role="main" aria-labelledby="class-Gravaty::Parsers::Avatar">
|
83
|
+
<h1 id="class-Gravaty::Parsers::Avatar" class="class">
|
84
|
+
class Gravaty::Parsers::Avatar
|
85
|
+
</h1>
|
86
|
+
|
87
|
+
<section class="description">
|
88
|
+
|
89
|
+
<p>This class is an implementation of the Parsable duck type that checks for
|
90
|
+
avater or profile URI. The only needed parameter is a boolean, with
|
91
|
+
<code>true</code> for avatar.</p>
|
92
|
+
<dl class="rdoc-list note-list"><dt>Author
|
93
|
+
<dd>
|
94
|
+
<p><a href="mailto:m.bresciani@email.it">Marco Bresciani</a></p>
|
95
|
+
</dd><dt>Copyright
|
96
|
+
<dd>
|
97
|
+
<p>Copyright © 2013, 2014, 2015, 2016 Marco Bresciani</p>
|
98
|
+
</dd><dt>License
|
99
|
+
<dd>
|
100
|
+
<p>GNU General Public License version 3</p>
|
101
|
+
</dd></dl>
|
102
|
+
|
103
|
+
</section>
|
104
|
+
|
105
|
+
|
106
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
117
|
+
<header>
|
118
|
+
<h3>Public Instance Methods</h3>
|
119
|
+
</header>
|
120
|
+
|
121
|
+
|
122
|
+
<div id="method-i-parse" class="method-detail ">
|
123
|
+
|
124
|
+
<div class="method-heading">
|
125
|
+
<span class="method-name">parse</span><span
|
126
|
+
class="method-args">(value = true)</span>
|
127
|
+
|
128
|
+
<span class="method-click-advice">click to toggle source</span>
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
|
135
|
+
<p>The parsable duck type interface to every parser usage.</p>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<div class="method-source-code" id="parse-source">
|
141
|
+
<pre><span class="ruby-comment"># File lib/gravaty/parsers/avatar.rb, line 28</span>
|
142
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword">true</span>)
|
143
|
+
<span class="ruby-identifier">value</span> <span class="ruby-operator">?</span> <span class="ruby-string">'avatar/'</span> <span class="ruby-operator">:</span> <span class="ruby-string">''</span>
|
144
|
+
<span class="ruby-keyword">end</span></pre>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
</section>
|
156
|
+
|
157
|
+
</section>
|
158
|
+
</main>
|
159
|
+
|
160
|
+
|
161
|
+
<footer id="validator-badges" role="contentinfo">
|
162
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
163
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.4.
|
164
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
165
|
+
</footer>
|
166
|
+
|
@@ -0,0 +1,167 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Gravaty::Parsers::Callback - gravaty 8.0.0</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../";
|
11
|
+
var index_rel_prefix = "../../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../../js/jquery.js"></script>
|
15
|
+
<script src="../../js/darkfish.js"></script>
|
16
|
+
|
17
|
+
<link href="../../css/fonts.css" rel="stylesheet">
|
18
|
+
<link href="../../css/rdoc.css" rel="stylesheet">
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
<body id="top" role="document" class="class">
|
23
|
+
<nav role="navigation">
|
24
|
+
<div id="project-navigation">
|
25
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
26
|
+
<h2>
|
27
|
+
<a href="../../index.html" rel="home">Home</a>
|
28
|
+
</h2>
|
29
|
+
|
30
|
+
<div id="table-of-contents-navigation">
|
31
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
32
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
33
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
38
|
+
<form action="#" method="get" accept-charset="utf-8">
|
39
|
+
<div id="search-field-wrapper">
|
40
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
41
|
+
aria-autocomplete="list" aria-controls="search-results"
|
42
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
43
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<ul id="search-results" aria-label="Search Results"
|
47
|
+
aria-busy="false" aria-expanded="false"
|
48
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
49
|
+
</form>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
<div id="class-metadata">
|
57
|
+
|
58
|
+
<div id="parent-class-section" class="nav-section">
|
59
|
+
<h3>Parent</h3>
|
60
|
+
|
61
|
+
|
62
|
+
<p class="link"><a href="../../Object.html">Object</a>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
<!-- Method Quickref -->
|
69
|
+
<div id="method-list-section" class="nav-section">
|
70
|
+
<h3>Methods</h3>
|
71
|
+
|
72
|
+
<ul class="link-list" role="directory">
|
73
|
+
|
74
|
+
<li ><a href="#method-i-parse">#parse</a>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
</div>
|
80
|
+
</nav>
|
81
|
+
|
82
|
+
<main role="main" aria-labelledby="class-Gravaty::Parsers::Callback">
|
83
|
+
<h1 id="class-Gravaty::Parsers::Callback" class="class">
|
84
|
+
class Gravaty::Parsers::Callback
|
85
|
+
</h1>
|
86
|
+
|
87
|
+
<section class="description">
|
88
|
+
|
89
|
+
<p>This class is an implementation of the Parsable duck type that provides the
|
90
|
+
callback name. The only needed parameter is a valid callback
|
91
|
+
<code>String</code> name.</p>
|
92
|
+
<dl class="rdoc-list note-list"><dt>Author
|
93
|
+
<dd>
|
94
|
+
<p><a href="mailto:m.bresciani@email.it">Marco Bresciani</a></p>
|
95
|
+
</dd><dt>Copyright
|
96
|
+
<dd>
|
97
|
+
<p>Copyright © 2013, 2014, 2015, 2016 Marco Bresciani</p>
|
98
|
+
</dd><dt>License
|
99
|
+
<dd>
|
100
|
+
<p>GNU General Public License version 3</p>
|
101
|
+
</dd></dl>
|
102
|
+
|
103
|
+
</section>
|
104
|
+
|
105
|
+
|
106
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
117
|
+
<header>
|
118
|
+
<h3>Public Instance Methods</h3>
|
119
|
+
</header>
|
120
|
+
|
121
|
+
|
122
|
+
<div id="method-i-parse" class="method-detail ">
|
123
|
+
|
124
|
+
<div class="method-heading">
|
125
|
+
<span class="method-name">parse</span><span
|
126
|
+
class="method-args">(value = nil)</span>
|
127
|
+
|
128
|
+
<span class="method-click-advice">click to toggle source</span>
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
|
135
|
+
<p>The parsable duck type interface to every parser usage.</p>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<div class="method-source-code" id="parse-source">
|
141
|
+
<pre><span class="ruby-comment"># File lib/gravaty/parsers/callback.rb, line 28</span>
|
142
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword">nil</span>)
|
143
|
+
<span class="ruby-keyword">return</span> <span class="ruby-node">"callback=#{value}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">empty?</span>
|
144
|
+
<span class="ruby-string">''</span>
|
145
|
+
<span class="ruby-keyword">end</span></pre>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
</div>
|
154
|
+
|
155
|
+
|
156
|
+
</section>
|
157
|
+
|
158
|
+
</section>
|
159
|
+
</main>
|
160
|
+
|
161
|
+
|
162
|
+
<footer id="validator-badges" role="contentinfo">
|
163
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
164
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.4.
|
165
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
166
|
+
</footer>
|
167
|
+
|
@@ -0,0 +1,174 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Gravaty::Parsers::Default - gravaty 8.0.0</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../";
|
11
|
+
var index_rel_prefix = "../../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../../js/jquery.js"></script>
|
15
|
+
<script src="../../js/darkfish.js"></script>
|
16
|
+
|
17
|
+
<link href="../../css/fonts.css" rel="stylesheet">
|
18
|
+
<link href="../../css/rdoc.css" rel="stylesheet">
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
<body id="top" role="document" class="class">
|
23
|
+
<nav role="navigation">
|
24
|
+
<div id="project-navigation">
|
25
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
26
|
+
<h2>
|
27
|
+
<a href="../../index.html" rel="home">Home</a>
|
28
|
+
</h2>
|
29
|
+
|
30
|
+
<div id="table-of-contents-navigation">
|
31
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
32
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
33
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
38
|
+
<form action="#" method="get" accept-charset="utf-8">
|
39
|
+
<div id="search-field-wrapper">
|
40
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
41
|
+
aria-autocomplete="list" aria-controls="search-results"
|
42
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
43
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<ul id="search-results" aria-label="Search Results"
|
47
|
+
aria-busy="false" aria-expanded="false"
|
48
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
49
|
+
</form>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
<div id="class-metadata">
|
57
|
+
|
58
|
+
<div id="parent-class-section" class="nav-section">
|
59
|
+
<h3>Parent</h3>
|
60
|
+
|
61
|
+
|
62
|
+
<p class="link"><a href="../../Object.html">Object</a>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
<!-- Method Quickref -->
|
69
|
+
<div id="method-list-section" class="nav-section">
|
70
|
+
<h3>Methods</h3>
|
71
|
+
|
72
|
+
<ul class="link-list" role="directory">
|
73
|
+
|
74
|
+
<li ><a href="#method-i-parse">#parse</a>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
</div>
|
80
|
+
</nav>
|
81
|
+
|
82
|
+
<main role="main" aria-labelledby="class-Gravaty::Parsers::Default">
|
83
|
+
<h1 id="class-Gravaty::Parsers::Default" class="class">
|
84
|
+
class Gravaty::Parsers::Default
|
85
|
+
</h1>
|
86
|
+
|
87
|
+
<section class="description">
|
88
|
+
|
89
|
+
<p>This class is an implementation of the Parsable duck type that checks the
|
90
|
+
default option. The only needed parameter is a valid default option.</p>
|
91
|
+
<dl class="rdoc-list note-list"><dt>Author
|
92
|
+
<dd>
|
93
|
+
<p><a href="mailto:m.bresciani@email.it">Marco Bresciani</a></p>
|
94
|
+
</dd><dt>Copyright
|
95
|
+
<dd>
|
96
|
+
<p>Copyright © 2013, 2014, 2015, 2016 Marco Bresciani</p>
|
97
|
+
</dd><dt>License
|
98
|
+
<dd>
|
99
|
+
<p>GNU General Public License version 3</p>
|
100
|
+
</dd></dl>
|
101
|
+
|
102
|
+
</section>
|
103
|
+
|
104
|
+
|
105
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
116
|
+
<header>
|
117
|
+
<h3>Public Instance Methods</h3>
|
118
|
+
</header>
|
119
|
+
|
120
|
+
|
121
|
+
<div id="method-i-parse" class="method-detail ">
|
122
|
+
|
123
|
+
<div class="method-heading">
|
124
|
+
<span class="method-name">parse</span><span
|
125
|
+
class="method-args">(value = nil)</span>
|
126
|
+
|
127
|
+
<span class="method-click-advice">click to toggle source</span>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
<div class="method-description">
|
133
|
+
|
134
|
+
<p>The parsable duck type interface to every parser usage.</p>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<div class="method-source-code" id="parse-source">
|
140
|
+
<pre><span class="ruby-comment"># File lib/gravaty/parsers/default.rb, line 32</span>
|
141
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword">nil</span>)
|
142
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">empty?</span>
|
143
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">DEFAULT_OPTIONS</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">value</span>
|
144
|
+
<span class="ruby-identifier">valid</span> = <span class="ruby-node">%w(http https)</span>.<span class="ruby-identifier">index</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">scheme</span><span class="ruby-operator">|</span> <span class="ruby-identifier">valid?</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">scheme</span>) }
|
145
|
+
|
146
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-string">'error.uri'</span>, <span class="ruby-value">value:</span> <span class="ruby-identifier">value</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">valid</span>.<span class="ruby-identifier">nil?</span>
|
147
|
+
<span class="ruby-keyword">end</span>
|
148
|
+
|
149
|
+
<span class="ruby-keyword">return</span> <span class="ruby-string">'d='</span> <span class="ruby-operator">+</span> <span class="ruby-constant">CGI</span><span class="ruby-operator">::</span><span class="ruby-identifier">escape</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">to_s</span>
|
150
|
+
<span class="ruby-keyword">end</span>
|
151
|
+
<span class="ruby-string">''</span>
|
152
|
+
<span class="ruby-keyword">end</span></pre>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
</div>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
</section>
|
164
|
+
|
165
|
+
</section>
|
166
|
+
</main>
|
167
|
+
|
168
|
+
|
169
|
+
<footer id="validator-badges" role="contentinfo">
|
170
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
171
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.4.
|
172
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
173
|
+
</footer>
|
174
|
+
|