shep 0.1.0.pre.alpha0 → 0.2.0.pre.alpha0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/Rakefile +1 -0
  4. data/doc/Shep/Entity/Account.html +22 -37
  5. data/doc/Shep/Entity/Context.html +8 -9
  6. data/doc/Shep/Entity/CustomEmoji.html +11 -15
  7. data/doc/Shep/Entity/MediaAttachment.html +13 -19
  8. data/doc/Shep/Entity/Notification.html +11 -15
  9. data/doc/Shep/Entity/Status.html +34 -61
  10. data/doc/Shep/Entity/StatusSource.html +9 -11
  11. data/doc/Shep/Entity/Status_Application.html +11 -10
  12. data/doc/Shep/Entity/Status_Mention.html +10 -13
  13. data/doc/Shep/Entity/Status_Tag.html +8 -9
  14. data/doc/Shep/Entity.html +156 -141
  15. data/doc/Shep/Error/Caller.html +4 -4
  16. data/doc/Shep/Error/Http.html +13 -13
  17. data/doc/Shep/Error/RateLimit.html +176 -0
  18. data/doc/Shep/Error/Remote.html +3 -4
  19. data/doc/Shep/Error/Server.html +5 -4
  20. data/doc/Shep/Error/Type.html +6 -8
  21. data/doc/Shep/Error.html +5 -5
  22. data/doc/Shep/Session.html +895 -570
  23. data/doc/Shep.html +20 -5
  24. data/doc/_index.html +10 -3
  25. data/doc/class_list.html +1 -1
  26. data/doc/file.README.html +52 -33
  27. data/doc/file_list.html +1 -1
  28. data/doc/index.html +117 -239
  29. data/doc/method_list.html +9 -1
  30. data/doc/top-level-namespace.html +2 -2
  31. data/lib/shep/entity_base.rb +6 -1
  32. data/lib/shep/exceptions.rb +5 -0
  33. data/lib/shep/session.rb +292 -146
  34. data/lib/shep/version.rb +4 -0
  35. data/lib/shep.rb +1 -1
  36. data/run_rake_test.example.sh +12 -5
  37. data/shep.gemspec +4 -2
  38. data/spec/session_reader_1_unauth_spec.rb +20 -17
  39. data/spec/session_reader_2_auth_spec.rb +17 -19
  40. data/spec/session_writer_spec.rb +4 -11
  41. data/spec/session_zzz_tricky_spec.rb +136 -0
  42. data/spec/spec_helper.rb +12 -3
  43. metadata +12 -9
data/doc/Shep/Entity.html CHANGED
@@ -101,39 +101,52 @@
101
101
 
102
102
  <h2>Overview</h2><div class="docstring">
103
103
  <div class="discussion">
104
-
105
- <p>Abstract base class for Mastodon objects.</p>
104
+ <p>Abstract base class for Mastodon objects.</p>
106
105
 
107
- <p>Mastodon provides its content as JSON hashes with documented names and values. Shep takes this one step further and provides a class for each object type. These are similar to Ruby’s <code>Struct</code> but are also strongly typed.</p>
106
+ <p>Mastodon provides its content as JSON hashes with documented names
107
+ and values. Shep takes this one step further and provides a class
108
+ for each object type. These are similar to Ruby&#39;s <code>Struct</code> but
109
+ are also strongly typed.</p>
108
110
 
109
- <p>Typing is primarily useful for converting things that dont have explicit JSON types (e.g. Time, URI) into Ruby types. However, it will also catch the case where you’re trying to set a field to something with the wrong type.</p>
111
+ <p>Typing is primarily useful for converting things that don&#39;t have
112
+ explicit JSON types (e.g. Time, URI) into Ruby types. However, it
113
+ will also catch the case where you&#39;re trying to set a field to
114
+ something with the wrong type.</p>
110
115
 
111
116
  <p>Supported types are:</p>
112
- <ul><li>
113
- <p>Number - (Integer but also allows Float)</p>
114
- </li><li>
115
- <p>Boolean</p>
116
- </li><li>
117
- <p>String</p>
118
- </li><li>
119
- <p>URI - (a Ruby URI object)</p>
120
- </li><li>
121
- <p>Time - parsed from and converted to ISO8601-format strings</p>
122
- </li><li>
123
- <p>Entity - an arbitrary Entity subclass</p>
124
- </li><li>
125
- <p>Array - strongly typed array of any of the above types</p>
126
- </li></ul>
127
117
 
128
- <p>Fields may also be set to nil, except for <code>Array</code> which must instead be set to an ampty array.</p>
118
+ <ul>
119
+ <li>Number - (Integer but also allows Float)</li>
120
+ <li>Boolean</li>
121
+ <li>String</li>
122
+ <li>URI - (a Ruby URI object)</li>
123
+ <li>Time - parsed from and converted to ISO8601-format strings</li>
124
+ <li>Entity - an arbitrary Entity subclass</li>
125
+ <li>Array - strongly typed array of any of the above types</li>
126
+ </ul>
127
+
128
+ <p>Fields may also be set to nil, except for <code>Array</code> which must
129
+ instead be set to an ampty array.</p>
129
130
 
130
- <p>Entities can be converted to and from Ruby Hashes. For this, we provide two flavours of Hash: the regular Ruby Hash where values are just the Ruby objects and the JSON hash where everything has been converted to the types expected by a Mastodon server.</p>
131
+ <p>Entities can be converted to and from Ruby Hashes. For this, we
132
+ provide two flavours of Hash: the regular Ruby Hash where values
133
+ are just the Ruby objects and the JSON hash where everything has
134
+ been converted to the types expected by a Mastodon server.</p>
131
135
 
132
- <p>For JSON hashes, <code>Time</code> objects become ISO8601-formatted strings, <code>URI</code> objects become strings containing the url and <code>Entity</code> subobjects become their own JSON hashes. (Note that conversion to JSON hashes isn’t really used outside of some testing and internal stuff so I don’t guarantee that a Mastodon server or client will accept them.)</p>
136
+ <p>For JSON hashes, <code>Time</code> objects become ISO8601-formatted strings,
137
+ <code>URI</code> objects become strings containing the url and <code>Entity</code>
138
+ subobjects become their own JSON hashes. (Note that conversion to
139
+ JSON hashes isn&#39;t really used outside of some testing and internal
140
+ stuff so I don&#39;t guarantee that a Mastodon server or client will
141
+ accept them.)</p>
133
142
 
134
- <p>Normally, we care about initializing Entity objects from the corresponding parsed JSON object and produce Ruby hashes when we need to use a feature <code>Hash</code> provides.</p>
143
+ <p>Normally, we care about initializing Entity objects from the
144
+ corresponding parsed JSON object and produce Ruby hashes when we
145
+ need to use a feature <code>Hash</code> provides.</p>
135
146
 
136
- <p>Subclasses are all defined inside the Entity namespace so that it groups nicely in YARD docs (and because it makes the intent obvious).</p>
147
+ <p>Subclasses are all defined inside the Entity namespace so that it
148
+ groups nicely in YARD docs (and because it makes the intent
149
+ obvious).</p>
137
150
 
138
151
 
139
152
  </div>
@@ -187,8 +200,7 @@
187
200
  <span class="private note title">private</span>
188
201
 
189
202
 
190
- <span class="summary_desc"><div class='inline'>
191
- <p>Cool metaprogramming thing for defining <span class='object_link'><a href="" title="Shep::Entity (class)">Entity</a></span> subclasses.</p>
203
+ <span class="summary_desc"><div class='inline'><p>Cool metaprogramming thing for defining <span class='object_link'><a href="" title="Shep::Entity (class)">Entity</a></span> subclasses.</p>
192
204
  </div></span>
193
205
 
194
206
  </li>
@@ -211,8 +223,7 @@
211
223
 
212
224
 
213
225
 
214
- <span class="summary_desc"><div class='inline'>
215
- <p>Construct an instance from the (parsed) JSON object returned by Mastodon.</p>
226
+ <span class="summary_desc"><div class='inline'><p>Construct an instance from the (parsed) JSON object returned by Mastodon.</p>
216
227
  </div></span>
217
228
 
218
229
  </li>
@@ -235,8 +246,7 @@
235
246
 
236
247
 
237
248
 
238
- <span class="summary_desc"><div class='inline'>
239
- <p>Construct an instance initialized with Ruby objects.</p>
249
+ <span class="summary_desc"><div class='inline'><p>Construct an instance initialized with Ruby objects.</p>
240
250
  </div></span>
241
251
 
242
252
  </li>
@@ -268,8 +278,7 @@
268
278
 
269
279
 
270
280
 
271
- <span class="summary_desc"><div class='inline'>
272
- <p>Compare for equality.</p>
281
+ <span class="summary_desc"><div class='inline'><p>Compare for equality.</p>
273
282
  </div></span>
274
283
 
275
284
  </li>
@@ -292,8 +301,7 @@
292
301
 
293
302
 
294
303
 
295
- <span class="summary_desc"><div class='inline'>
296
- <p>Retrieve a field value by name.</p>
304
+ <span class="summary_desc"><div class='inline'><p>Retrieve a field value by name.</p>
297
305
  </div></span>
298
306
 
299
307
  </li>
@@ -316,8 +324,7 @@
316
324
 
317
325
 
318
326
 
319
- <span class="summary_desc"><div class='inline'>
320
- <p>Set a field value by name.</p>
327
+ <span class="summary_desc"><div class='inline'><p>Set a field value by name.</p>
321
328
  </div></span>
322
329
 
323
330
  </li>
@@ -342,8 +349,7 @@
342
349
 
343
350
 
344
351
 
345
- <span class="summary_desc"><div class='inline'>
346
- <p>Default constructor; creates an empty instance.</p>
352
+ <span class="summary_desc"><div class='inline'><p>Default constructor; creates an empty instance.</p>
347
353
  </div></span>
348
354
 
349
355
  </li>
@@ -366,8 +372,7 @@
366
372
 
367
373
 
368
374
 
369
- <span class="summary_desc"><div class='inline'>
370
- <p>Wrapper around <code>puts to_long_s()</code>.</p>
375
+ <span class="summary_desc"><div class='inline'><p>Wrapper around <code>puts to_long_s()</code>.</p>
371
376
  </div></span>
372
377
 
373
378
  </li>
@@ -390,8 +395,7 @@
390
395
 
391
396
 
392
397
 
393
- <span class="summary_desc"><div class='inline'>
394
- <p>Set all fields from a hash.</p>
398
+ <span class="summary_desc"><div class='inline'><p>Set all fields from a hash.</p>
395
399
  </div></span>
396
400
 
397
401
  </li>
@@ -414,8 +418,7 @@
414
418
 
415
419
 
416
420
 
417
- <span class="summary_desc"><div class='inline'>
418
- <p>Return a hash of the contents mapping field name to value.</p>
421
+ <span class="summary_desc"><div class='inline'><p>Return a hash of the contents mapping field name to value.</p>
419
422
  </div></span>
420
423
 
421
424
  </li>
@@ -438,8 +441,7 @@
438
441
 
439
442
 
440
443
 
441
- <span class="summary_desc"><div class='inline'>
442
- <p>Produce a long-form human-friendly description of this Entity.</p>
444
+ <span class="summary_desc"><div class='inline'><p>Produce a long-form human-friendly description of this Entity.</p>
443
445
  </div></span>
444
446
 
445
447
  </li>
@@ -464,8 +466,7 @@
464
466
 
465
467
 
466
468
 
467
- <span class="summary_desc"><div class='inline'>
468
- <p>Produce a <strong>short</strong> human-friendly description.</p>
469
+ <span class="summary_desc"><div class='inline'><p>Produce a <strong>short</strong> human-friendly description.</p>
469
470
  </div></span>
470
471
 
471
472
  </li>
@@ -488,8 +489,8 @@
488
489
 
489
490
  </h3><div class="docstring">
490
491
  <div class="discussion">
491
-
492
- <p>Default constructor; creates an empty instance. You’ll probably want to use <span class='object_link'><a href="#with-class_method" title="Shep::Entity.with (method)">with</a></span> or <span class='object_link'><a href="#from-class_method" title="Shep::Entity.from (method)">from</a></span> instead.</p>
492
+ <p>Default constructor; creates an empty instance. You&#39;ll
493
+ probably want to use <span class='object_link'><a href="#with-class_method" title="Shep::Entity.with (method)">with</a></span> or <span class='object_link'><a href="#from-class_method" title="Shep::Entity.from (method)">from</a></span> instead.</p>
493
494
 
494
495
 
495
496
  </div>
@@ -540,10 +541,10 @@
540
541
  <strong>This method is part of a private API.</strong>
541
542
  You should avoid using this method if possible, as it may be removed or be changed in the future.
542
543
  </p>
543
-
544
544
  <p>Cool metaprogramming thing for defining <span class='object_link'><a href="" title="Shep::Entity (class)">Shep::Entity</a></span> subclasses.</p>
545
545
 
546
- <p>A typical <span class='object_link'><a href="" title="Shep::Entity (class)">Shep::Entity</a></span> subclass should contain only a call to this method. For example:</p>
546
+ <p>A typical <span class='object_link'><a href="" title="Shep::Entity (class)">Shep::Entity</a></span> subclass should contain only a call to this
547
+ method. For example:</p>
547
548
 
548
549
  <pre class="code ruby"><code class="ruby"> <span class='kw'>class</span> <span class='const'>Thingy</span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="" title="Shep::Entity (class)">Entity</a></span></span>
549
550
  <span class='id identifier rubyid_fields'>fields</span><span class='lparen'>(</span>
@@ -555,23 +556,31 @@
555
556
  <span class='kw'>end</span>
556
557
  </code></pre>
557
558
 
558
- <p><span class='object_link'><a href="#fields-class_method" title="Shep::Entity.fields (method)">fields</a></span> takes a variable sequence of arguments that must be grouped as follows:</p>
559
- <ol><li>
560
- <p>The field name. This <strong>must</strong> be a symbol.</p>
561
- </li><li>
562
- <p>An optional Array containing the symbol :show. If given, this field will be included in the string returned by <code>to_s</code>. (This is actually a mechanism for setting various properties, but all we need is <code>:show</code>, so that's it for now.)</p>
563
- </li><li>
564
- <p>The type specifier. If omitted, defaults to StringBox.</p>
565
- </li></ol>
559
+ <p><span class='object_link'><a href="#fields-class_method" title="Shep::Entity.fields (method)">fields</a></span> takes a variable sequence of arguments that must be
560
+ grouped as follows:</p>
561
+
562
+ <ol>
563
+ <li><p>The field name. This <strong>must</strong> be a symbol.</p></li>
564
+ <li><p>An optional Array containing the symbol :show. If given,
565
+ this field will be included in the string returned by
566
+ <code>to_s</code>. (This is actually a mechanism for setting various
567
+ properties, but all we need is <code>:show</code>, so that&#39;s it for
568
+ now.)</p></li>
569
+ <li><p>The type specifier. If omitted, defaults to StringBox.</p></li>
570
+ </ol>
566
571
 
567
572
  <p>The type specifier must be either:</p>
568
- <ol><li>
569
- <p>One of the following classes: <code>TypeBox</code>, <code>StringBox</code>, <code>TimeBox</code>, <code>URIBox</code>, or <code>NumBox</code>, corresponding to the type this field will be.</p>
570
- </li><li>
571
- <p>A subclass of Entity, indicating that this field holds another Mastodon object.</p>
572
- </li><li>
573
- <p>An Array holding a single element which must be one of the above classes, indicating that the field holds an array of items of that type.</p>
574
- </li></ol>
573
+
574
+ <ol>
575
+ <li><p>One of the following classes: <code>TypeBox</code>, <code>StringBox</code>,
576
+ <code>TimeBox</code>, <code>URIBox</code>, or <code>NumBox</code>, corresponding to the type
577
+ this field will be.</p></li>
578
+ <li><p>A subclass of Entity, indicating that this field holds
579
+ another Mastodon object.</p></li>
580
+ <li><p>An Array holding a single element which must be one of the
581
+ above classes, indicating that the field holds an array of
582
+ items of that type.</p></li>
583
+ </ol>
575
584
 
576
585
 
577
586
  </div>
@@ -585,11 +594,6 @@
585
594
  <pre class="lines">
586
595
 
587
596
 
588
- 276
589
- 277
590
- 278
591
- 279
592
- 280
593
597
  281
594
598
  282
595
599
  283
@@ -649,10 +653,15 @@
649
653
  337
650
654
  338
651
655
  339
652
- 340</pre>
656
+ 340
657
+ 341
658
+ 342
659
+ 343
660
+ 344
661
+ 345</pre>
653
662
  </td>
654
663
  <td>
655
- <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 276</span>
664
+ <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 281</span>
656
665
 
657
666
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fields'>fields</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_flds'>flds</span><span class='rparen'>)</span>
658
667
  <span class='id identifier rubyid_known_props'>known_props</span> <span class='op'>=</span> <span class='qsymbols_beg'>%i{</span><span class='tstring_content'>show</span><span class='tstring_end'>}</span></span><span class='period'>.</span><span class='id identifier rubyid_to_set'>to_set</span>
@@ -735,10 +744,13 @@
735
744
 
736
745
  </h3><div class="docstring">
737
746
  <div class="discussion">
738
-
739
- <p>Construct an instance from the (parsed) JSON object returned by Mastodon.</p>
747
+ <p>Construct an instance from the (parsed) JSON object returned by
748
+ Mastodon.</p>
740
749
 
741
- <p>Values must be of the expected types as they appear in the Mastodon object (i.e. the JSON Hash described above). Missing key/value pairs are allowed and treated as nil; unknown keys are ignored.</p>
750
+ <p>Values must be of the expected types as they appear in the
751
+ Mastodon object (i.e. the JSON Hash described above). Missing
752
+ key/value pairs are allowed and treated as nil; unknown keys are
753
+ ignored.</p>
742
754
 
743
755
 
744
756
  </div>
@@ -776,10 +788,11 @@
776
788
 
777
789
  </h3><div class="docstring">
778
790
  <div class="discussion">
779
-
780
- <p>Construct an instance initialized with Ruby objects.</p>
791
+ <p>Construct an instance initialized with Ruby objects.</p>
781
792
 
782
- <p>This intended for creating <span class='object_link'><a href="" title="Shep::Entity (class)">Shep::Entity</a></span> subobjects in Ruby code. Keys of <span class='object_link'><a href="#fields-class_method" title="Shep::Entity.fields (method)">fields</a></span> must correspond to the class’s supported fields and be of the correct type. No fields may be omitted.</p>
793
+ <p>This intended for creating <span class='object_link'><a href="" title="Shep::Entity (class)">Shep::Entity</a></span> subobjects in Ruby code.
794
+ Keys of <span class='object_link'><a href="#fields-class_method" title="Shep::Entity.fields (method)">fields</a></span> must correspond to the class&#39;s supported fields
795
+ and be of the correct type. No fields may be omitted.</p>
783
796
 
784
797
 
785
798
  </div>
@@ -827,10 +840,11 @@
827
840
 
828
841
  </h3><div class="docstring">
829
842
  <div class="discussion">
830
-
831
- <p>Compare for equality.</p>
843
+ <p>Compare for equality.</p>
832
844
 
833
- <p>Two Entity subinstances are identical if they are of the same class and all of their field values are also equal according to <code>:==</code></p>
845
+ <p>Two Entity subinstances are identical if they are of the same
846
+ class and all of their field values are also equal according to
847
+ <code>:==</code></p>
834
848
 
835
849
 
836
850
  </div>
@@ -857,14 +871,14 @@
857
871
  <pre class="lines">
858
872
 
859
873
 
860
- 176
861
- 177
862
- 178
863
- 179
864
- 180</pre>
874
+ 181
875
+ 182
876
+ 183
877
+ 184
878
+ 185</pre>
865
879
  </td>
866
880
  <td>
867
- <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 176</span>
881
+ <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 181</span>
868
882
 
869
883
  <span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
870
884
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
@@ -887,8 +901,7 @@
887
901
 
888
902
  </h3><div class="docstring">
889
903
  <div class="discussion">
890
-
891
- <p>Retrieve a field value by name</p>
904
+ <p>Retrieve a field value by name</p>
892
905
 
893
906
 
894
907
  </div>
@@ -930,10 +943,10 @@
930
943
  <pre class="lines">
931
944
 
932
945
 
933
- 156</pre>
946
+ 161</pre>
934
947
  </td>
935
948
  <td>
936
- <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 156</span>
949
+ <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 161</span>
937
950
 
938
951
  <span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='id identifier rubyid_getbox'>getbox</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span></pre>
939
952
  </td>
@@ -952,8 +965,7 @@
952
965
 
953
966
  </h3><div class="docstring">
954
967
  <div class="discussion">
955
-
956
- <p>Set a field value by name</p>
968
+ <p>Set a field value by name</p>
957
969
 
958
970
 
959
971
  </div>
@@ -997,8 +1009,7 @@
997
1009
 
998
1010
 
999
1011
  &mdash;
1000
- <div class='inline'>
1001
- <p>the <code>value</code> parameter</p>
1012
+ <div class='inline'><p>the <code>value</code> parameter</p>
1002
1013
  </div>
1003
1014
 
1004
1015
  </li>
@@ -1011,13 +1022,13 @@
1011
1022
  <pre class="lines">
1012
1023
 
1013
1024
 
1014
- 164
1015
- 165
1016
- 166
1017
- 167</pre>
1025
+ 169
1026
+ 170
1027
+ 171
1028
+ 172</pre>
1018
1029
  </td>
1019
1030
  <td>
1020
- <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 164</span>
1031
+ <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 169</span>
1021
1032
 
1022
1033
  <span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1023
1034
  <span class='id identifier rubyid_getbox'>getbox</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
@@ -1039,8 +1050,7 @@
1039
1050
 
1040
1051
  </h3><div class="docstring">
1041
1052
  <div class="discussion">
1042
-
1043
- <p>Wrapper around <code>puts to_long_s()</code></p>
1053
+ <p>Wrapper around <code>puts to_long_s()</code></p>
1044
1054
 
1045
1055
 
1046
1056
  </div>
@@ -1054,10 +1064,10 @@
1054
1064
  <pre class="lines">
1055
1065
 
1056
1066
 
1057
- 227</pre>
1067
+ 232</pre>
1058
1068
  </td>
1059
1069
  <td>
1060
- <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 227</span>
1070
+ <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 232</span>
1061
1071
 
1062
1072
  <span class='kw'>def</span> <span class='id identifier rubyid_print'>print</span> <span class='op'>=</span> <span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='id identifier rubyid_to_long_s'>to_long_s</span><span class='rparen'>)</span></pre>
1063
1073
  </td>
@@ -1076,8 +1086,7 @@
1076
1086
 
1077
1087
  </h3><div class="docstring">
1078
1088
  <div class="discussion">
1079
-
1080
- <p>Set all fields from a hash.</p>
1089
+ <p>Set all fields from a hash.</p>
1081
1090
 
1082
1091
  <p>This is the back-end for <span class='object_link'><a href="#from-class_method" title="Shep::Entity.from (method)">from</a></span> and <span class='object_link'><a href="#with-class_method" title="Shep::Entity.with (method)">with</a></span>.</p>
1083
1092
 
@@ -1098,8 +1107,7 @@
1098
1107
 
1099
1108
 
1100
1109
  &mdash;
1101
- <div class='inline'>
1102
- <p>the Hash containing the contents</p>
1110
+ <div class='inline'><p>the Hash containing the contents</p>
1103
1111
  </div>
1104
1112
 
1105
1113
  </li>
@@ -1116,8 +1124,7 @@
1116
1124
 
1117
1125
 
1118
1126
  &mdash;
1119
- <div class='inline'>
1120
- <p>if false, unknown keys cause an error</p>
1127
+ <div class='inline'><p>if false, unknown keys cause an error</p>
1121
1128
  </div>
1122
1129
 
1123
1130
  </li>
@@ -1134,8 +1141,9 @@
1134
1141
 
1135
1142
 
1136
1143
  &mdash;
1137
- <div class='inline'>
1138
- <p>if true, expect values in the format provided by the Mastodon API and convert accordingly. Otherwise, expect Ruby types.</p>
1144
+ <div class='inline'><p>if true, expect values in the format
1145
+ provided by the Mastodon API and convert
1146
+ accordingly. Otherwise, expect Ruby types.</p>
1139
1147
  </div>
1140
1148
 
1141
1149
  </li>
@@ -1205,10 +1213,10 @@
1205
1213
 
1206
1214
  </h3><div class="docstring">
1207
1215
  <div class="discussion">
1208
-
1209
- <p>Return a hash of the contents mapping field name to value.</p>
1216
+ <p>Return a hash of the contents mapping field name to value.</p>
1210
1217
 
1211
- <p>If <code>json_compatible</code> is true, the resulting hash will be easily convertable to Mastodon-format JSON. See above.</p>
1218
+ <p>If <code>json_compatible</code> is true, the resulting hash will be
1219
+ easily convertable to Mastodon-format JSON. See above.</p>
1212
1220
 
1213
1221
  <p>Unset (i.e. nil) values appear as entries with nil values.</p>
1214
1222
 
@@ -1231,8 +1239,7 @@
1231
1239
 
1232
1240
 
1233
1241
  &mdash;
1234
- <div class='inline'>
1235
- <p>if true, convert to JSON-friendly form</p>
1242
+ <div class='inline'><p>if true, convert to JSON-friendly form</p>
1236
1243
  </div>
1237
1244
 
1238
1245
  </li>
@@ -1259,11 +1266,6 @@
1259
1266
  <pre class="lines">
1260
1267
 
1261
1268
 
1262
- 192
1263
- 193
1264
- 194
1265
- 195
1266
- 196
1267
1269
  197
1268
1270
  198
1269
1271
  199
@@ -1272,10 +1274,15 @@
1272
1274
  202
1273
1275
  203
1274
1276
  204
1275
- 205</pre>
1277
+ 205
1278
+ 206
1279
+ 207
1280
+ 208
1281
+ 209
1282
+ 210</pre>
1276
1283
  </td>
1277
1284
  <td>
1278
- <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 192</span>
1285
+ <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 197</span>
1279
1286
 
1280
1287
  <span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span><span class='lparen'>(</span><span class='id identifier rubyid_json_compatible'>json_compatible</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1281
1288
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -1307,8 +1314,7 @@
1307
1314
 
1308
1315
  </h3><div class="docstring">
1309
1316
  <div class="discussion">
1310
-
1311
- <p>Produce a long-form human-friendly description of this Entity.</p>
1317
+ <p>Produce a long-form human-friendly description of this Entity.</p>
1312
1318
 
1313
1319
  <p>This is mostly here for debugging.</p>
1314
1320
 
@@ -1337,11 +1343,6 @@
1337
1343
  <pre class="lines">
1338
1344
 
1339
1345
 
1340
- 212
1341
- 213
1342
- 214
1343
- 215
1344
- 216
1345
1346
  217
1346
1347
  218
1347
1348
  219
@@ -1349,10 +1350,15 @@
1349
1350
  221
1350
1351
  222
1351
1352
  223
1352
- 224</pre>
1353
+ 224
1354
+ 225
1355
+ 226
1356
+ 227
1357
+ 228
1358
+ 229</pre>
1353
1359
  </td>
1354
1360
  <td>
1355
- <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 212</span>
1361
+ <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 217</span>
1356
1362
 
1357
1363
  <span class='kw'>def</span> <span class='id identifier rubyid_to_long_s'>to_long_s</span><span class='lparen'>(</span><span class='id identifier rubyid_indent_level'>indent_level</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
1358
1364
  <span class='id identifier rubyid_name_pad'>name_pad</span> <span class='op'>=</span> <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:size</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='op'>+</span> <span class='int'>2</span>
@@ -1387,8 +1393,7 @@
1387
1393
 
1388
1394
  </h3><div class="docstring">
1389
1395
  <div class="discussion">
1390
-
1391
- <p>Produce a <strong>short</strong> human-friendly description.</p>
1396
+ <p>Produce a <strong>short</strong> human-friendly description.</p>
1392
1397
 
1393
1398
 
1394
1399
  </div>
@@ -1423,15 +1428,25 @@
1423
1428
  135
1424
1429
  136
1425
1430
  137
1426
- 138</pre>
1431
+ 138
1432
+ 139
1433
+ 140
1434
+ 141
1435
+ 142
1436
+ 143</pre>
1427
1437
  </td>
1428
1438
  <td>
1429
1439
  <pre class="code"><span class="info file"># File 'lib/shep/entity_base.rb', line 130</span>
1430
1440
 
1431
1441
  <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
1442
+ <span class='id identifier rubyid_maxlen'>maxlen</span> <span class='op'>=</span> <span class='int'>20</span>
1432
1443
  <span class='id identifier rubyid_notable'>notable</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_disp_fields'>disp_fields</span><span class='lparen'>(</span><span class='rparen'>)</span>
1433
1444
  <span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_fld'>fld</span><span class='op'>|</span> <span class='id identifier rubyid_getbox'>getbox</span><span class='lparen'>(</span><span class='id identifier rubyid_fld'>fld</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_get_for_json'>get_for_json</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='rbrace'>}</span>
1434
- <span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_fld'>fld</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fld'>fld</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_getbox'>getbox</span><span class='lparen'>(</span><span class='id identifier rubyid_fld'>fld</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span>
1445
+ <span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_fld'>fld</span><span class='op'>|</span>
1446
+ <span class='id identifier rubyid_valtxt'>valtxt</span> <span class='op'>=</span> <span class='id identifier rubyid_getbox'>getbox</span><span class='lparen'>(</span><span class='id identifier rubyid_fld'>fld</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span>
1447
+ <span class='id identifier rubyid_valtxt'>valtxt</span> <span class='op'>=</span> <span class='id identifier rubyid_valtxt'>valtxt</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_maxlen'>maxlen</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>...</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_valtxt'>valtxt</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_maxlen'>maxlen</span><span class='op'>+</span><span class='int'>3</span>
1448
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fld'>fld</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_valtxt'>valtxt</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
1449
+ <span class='rbrace'>}</span>
1435
1450
  <span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1436
1451
  <span class='id identifier rubyid_notable'>notable</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0x</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_object_id'>object_id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='int'>16</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_notable'>notable</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1437
1452
 
@@ -1447,9 +1462,9 @@
1447
1462
  </div>
1448
1463
 
1449
1464
  <div id="footer">
1450
- Generated on Sun Jun 4 13:40:31 2023 by
1465
+ Generated on Sat Jun 10 19:16:29 2023 by
1451
1466
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1452
- 0.9.34 (ruby-3.1.0).
1467
+ 0.9.34 (ruby-3.0.3).
1453
1468
  </div>
1454
1469
 
1455
1470
  </div>