microformats 4.0.7 → 4.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +10 -0
  3. data/.gitignore +33 -15
  4. data/.rspec +3 -2
  5. data/.rubocop +3 -0
  6. data/.rubocop.yml +22 -0
  7. data/.ruby-version +1 -0
  8. data/.simplecov +11 -0
  9. data/.travis.yml +17 -2
  10. data/CONTRIBUTING.md +103 -0
  11. data/Guardfile +2 -2
  12. data/LICENSE +116 -0
  13. data/README.md +112 -172
  14. data/Rakefile +6 -7
  15. data/bin/microformats +10 -9
  16. data/lib/microformats.rb +15 -14
  17. data/lib/microformats/absolute_uri.rb +4 -8
  18. data/lib/microformats/format_parser.rb +271 -251
  19. data/lib/microformats/parser.rb +39 -39
  20. data/lib/microformats/parser_core.rb +142 -109
  21. data/lib/microformats/property_parser.rb +42 -65
  22. data/lib/microformats/results/collection.rb +19 -38
  23. data/lib/microformats/results/parser_result.rb +25 -37
  24. data/lib/microformats/results/property_set.rb +24 -31
  25. data/lib/microformats/time_property_parser.rb +122 -118
  26. data/lib/microformats/version.rb +1 -1
  27. data/logo.svg +23 -0
  28. data/microformats.gemspec +35 -33
  29. metadata +124 -451
  30. data/LICENSE.md +0 -36
  31. data/spec/lib/microformats/absolute_uri_spec.rb +0 -56
  32. data/spec/lib/microformats/parser_spec.rb +0 -132
  33. data/spec/lib/microformats_spec.rb +0 -33
  34. data/spec/spec_helper.rb +0 -10
  35. data/spec/support/cases/microformats.org/microformats-2/microformats-2-0.html +0 -2
  36. data/spec/support/cases/microformats.org/microformats-2/microformats-2-0.js +0 -9
  37. data/spec/support/cases/microformats.org/microformats-2/microformats-2-1.html +0 -2
  38. data/spec/support/cases/microformats.org/microformats-2/microformats-2-1.js +0 -10
  39. data/spec/support/cases/microformats.org/microformats-2/microformats-2-2.html +0 -5
  40. data/spec/support/cases/microformats.org/microformats-2/microformats-2-2.js +0 -11
  41. data/spec/support/cases/microformats.org/microformats-2/microformats-2-3.html +0 -17
  42. data/spec/support/cases/microformats.org/microformats-2/microformats-2-3.js +0 -20
  43. data/spec/support/cases/microformats.org/microformats-2/microformats-2-4.html +0 -16
  44. data/spec/support/cases/microformats.org/microformats-2/microformats-2-4.js +0 -24
  45. data/spec/support/cases/microformats.org/microformats-2/microformats-2-5.html +0 -7
  46. data/spec/support/cases/microformats.org/microformats-2/microformats-2-5.js +0 -11
  47. data/spec/support/cases/microformats.org/microformats-2/microformats-2-6.html +0 -9
  48. data/spec/support/cases/microformats.org/microformats-2/microformats-2-6.js +0 -18
  49. data/spec/support/cases/microformats.org/microformats-2/microformats-2-7.html +0 -9
  50. data/spec/support/cases/microformats.org/microformats-2/microformats-2-7.js +0 -18
  51. data/spec/support/cases/microformats.org/microformats-2/microformats-2-8.html +0 -9
  52. data/spec/support/cases/microformats.org/microformats-2/microformats-2-8.js +0 -17
  53. data/spec/support/cases/microformats.org/microformats-2/microformats-2-9.html +0 -9
  54. data/spec/support/cases/microformats.org/microformats-2/microformats-2-9.js +0 -17
  55. data/spec/support/lib/edge_cases/blank_href.html +0 -23
  56. data/spec/support/lib/edge_cases/blank_href.js +0 -15
  57. data/spec/support/lib/edge_cases/blank_rel.html +0 -23
  58. data/spec/support/lib/edge_cases/blank_rel.js +0 -41
  59. data/spec/support/lib/edge_cases/blank_src.html +0 -24
  60. data/spec/support/lib/edge_cases/blank_src.js +0 -16
  61. data/spec/support/lib/edge_cases/blank_value.html +0 -5
  62. data/spec/support/lib/edge_cases/blank_value.js +0 -19
  63. data/spec/support/lib/edge_cases/relative.html +0 -29
  64. data/spec/support/lib/edge_cases/relative.js +0 -15
  65. data/spec/support/lib/edge_cases/vcp-dates.html +0 -13
  66. data/spec/support/lib/edge_cases/vcp-dates.js +0 -30
  67. data/spec/support/lib/microformats/blank_href.html +0 -23
  68. data/spec/support/lib/microformats/blank_href.js +0 -11
  69. data/spec/support/lib/microformats/implied_property/name-fail.html +0 -60
  70. data/spec/support/lib/microformats/implied_property/name-pass.html +0 -30
  71. data/spec/support/lib/microformats/implied_property/photo-fail.html +0 -60
  72. data/spec/support/lib/microformats/implied_property/photo-pass.html +0 -30
  73. data/spec/support/lib/microformats/implied_property/url-fail.html +0 -18
  74. data/spec/support/lib/microformats/implied_property/url-pass.html +0 -12
  75. data/spec/support/lib/microformats/implied_property/url-relative.html +0 -13
  76. data/spec/support/lib/microformats/implied_property/url-unnormalized.html +0 -12
  77. data/spec/support/lib/microformats/nested-format-with-property-of-same-name.html +0 -13
  78. data/spec/support/lib/microformats/nested-format-with-property-of-same-name.js +0 -16
  79. data/spec/support/lib/microformats/nested-format-with-property.html +0 -12
  80. data/spec/support/lib/microformats/nested-format-with-property.js +0 -16
  81. data/spec/support/lib/microformats/nested-format-without-property.html +0 -13
  82. data/spec/support/lib/microformats/nested-property.html +0 -12
  83. data/spec/support/lib/microformats/nested-property.js +0 -10
  84. data/spec/support/lib/microformats/rels-that-drop-the-base.html +0 -11
  85. data/spec/support/lib/microformats/rels-with-unnormalized-urls.html +0 -11
  86. data/spec/support/lib/microformats/rels.html +0 -12
  87. data/spec/support/lib/microformats/rels.js +0 -13
  88. data/spec/support/lib/microformats/simple.html +0 -23
  89. data/spec/support/lib/microformats/simple.js +0 -11
  90. data/vendor/tests/.gitignore +0 -25
  91. data/vendor/tests/LICENSE.md +0 -36
  92. data/vendor/tests/README.md +0 -48
  93. data/vendor/tests/app.js +0 -84
  94. data/vendor/tests/composer.json +0 -5
  95. data/vendor/tests/css/testsuite.css +0 -159
  96. data/vendor/tests/interface.js +0 -18
  97. data/vendor/tests/package.json +0 -27
  98. data/vendor/tests/tests/microformats-mixed/h-card/change-log.html +0 -63
  99. data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.html +0 -14
  100. data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.json +0 -22
  101. data/vendor/tests/tests/microformats-mixed/h-card/tworoots.html +0 -1
  102. data/vendor/tests/tests/microformats-mixed/h-card/tworoots.json +0 -10
  103. data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.html +0 -16
  104. data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.json +0 -38
  105. data/vendor/tests/tests/microformats-mixed/h-resume/change-log.html +0 -68
  106. data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.html +0 -16
  107. data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.json +0 -31
  108. data/vendor/tests/tests/microformats-v1/adr/change-log.html +0 -63
  109. data/vendor/tests/tests/microformats-v1/adr/simpleproperties.html +0 -8
  110. data/vendor/tests/tests/microformats-v1/adr/simpleproperties.json +0 -15
  111. data/vendor/tests/tests/microformats-v1/geo/abbrpattern.html +0 -5
  112. data/vendor/tests/tests/microformats-v1/geo/abbrpattern.json +0 -11
  113. data/vendor/tests/tests/microformats-v1/geo/change-log.1.html +0 -78
  114. data/vendor/tests/tests/microformats-v1/geo/change-log.html +0 -63
  115. data/vendor/tests/tests/microformats-v1/geo/hidden.html +0 -10
  116. data/vendor/tests/tests/microformats-v1/geo/hidden.json +0 -11
  117. data/vendor/tests/tests/microformats-v1/geo/simpleproperties.html +0 -6
  118. data/vendor/tests/tests/microformats-v1/geo/simpleproperties.json +0 -11
  119. data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.html +0 -11
  120. data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.json +0 -11
  121. data/vendor/tests/tests/microformats-v1/hcalendar/ampm.html +0 -41
  122. data/vendor/tests/tests/microformats-v1/hcalendar/ampm.json +0 -21
  123. data/vendor/tests/tests/microformats-v1/hcalendar/attendees.html +0 -13
  124. data/vendor/tests/tests/microformats-v1/hcalendar/attendees.json +0 -37
  125. data/vendor/tests/tests/microformats-v1/hcalendar/change-log.html +0 -68
  126. data/vendor/tests/tests/microformats-v1/hcalendar/combining.html +0 -15
  127. data/vendor/tests/tests/microformats-v1/hcalendar/combining.json +0 -31
  128. data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.html +0 -7
  129. data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.json +0 -12
  130. data/vendor/tests/tests/microformats-v1/hcalendar/time.html +0 -44
  131. data/vendor/tests/tests/microformats-v1/hcalendar/time.json +0 -22
  132. data/vendor/tests/tests/microformats-v1/hcard/change-log.html +0 -68
  133. data/vendor/tests/tests/microformats-v1/hcard/email.html +0 -14
  134. data/vendor/tests/tests/microformats-v1/hcard/email.json +0 -11
  135. data/vendor/tests/tests/microformats-v1/hcard/format.html +0 -6
  136. data/vendor/tests/tests/microformats-v1/hcard/format.json +0 -11
  137. data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.html +0 -3
  138. data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.json +0 -8
  139. data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.html +0 -1
  140. data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.json +0 -8
  141. data/vendor/tests/tests/microformats-v1/hcard/justaname.html +0 -1
  142. data/vendor/tests/tests/microformats-v1/hcard/justaname.json +0 -8
  143. data/vendor/tests/tests/microformats-v1/hcard/multiple.html +0 -74
  144. data/vendor/tests/tests/microformats-v1/hcard/multiple.json +0 -65
  145. data/vendor/tests/tests/microformats-v1/hcard/name.html +0 -11
  146. data/vendor/tests/tests/microformats-v1/hcard/name.json +0 -15
  147. data/vendor/tests/tests/microformats-v1/hcard/single.html +0 -14
  148. data/vendor/tests/tests/microformats-v1/hcard/single.json +0 -24
  149. data/vendor/tests/tests/microformats-v1/hentry/change-log.html +0 -73
  150. data/vendor/tests/tests/microformats-v1/hentry/summarycontent.html +0 -20
  151. data/vendor/tests/tests/microformats-v1/hentry/summarycontent.json +0 -24
  152. data/vendor/tests/tests/microformats-v1/hfeed/simple.html +0 -30
  153. data/vendor/tests/tests/microformats-v1/hfeed/simple.json +0 -49
  154. data/vendor/tests/tests/microformats-v1/hnews/all.html +0 -37
  155. data/vendor/tests/tests/microformats-v1/hnews/all.json +0 -74
  156. data/vendor/tests/tests/microformats-v1/hnews/change-log.html +0 -72
  157. data/vendor/tests/tests/microformats-v1/hnews/minimum.html +0 -25
  158. data/vendor/tests/tests/microformats-v1/hnews/minimum.json +0 -48
  159. data/vendor/tests/tests/microformats-v1/hproduct/aggregate.html +0 -26
  160. data/vendor/tests/tests/microformats-v1/hproduct/aggregate.json +0 -52
  161. data/vendor/tests/tests/microformats-v1/hproduct/change-log.html +0 -62
  162. data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.html +0 -13
  163. data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.json +0 -33
  164. data/vendor/tests/tests/microformats-v1/hresume/affiliation.html +0 -12
  165. data/vendor/tests/tests/microformats-v1/hresume/affiliation.json +0 -25
  166. data/vendor/tests/tests/microformats-v1/hresume/change-log.html +0 -73
  167. data/vendor/tests/tests/microformats-v1/hresume/contact.html +0 -18
  168. data/vendor/tests/tests/microformats-v1/hresume/contact.json +0 -32
  169. data/vendor/tests/tests/microformats-v1/hresume/education.html +0 -13
  170. data/vendor/tests/tests/microformats-v1/hresume/education.json +0 -29
  171. data/vendor/tests/tests/microformats-v1/hresume/skill.html +0 -12
  172. data/vendor/tests/tests/microformats-v1/hresume/skill.json +0 -33
  173. data/vendor/tests/tests/microformats-v1/hresume/work.html +0 -16
  174. data/vendor/tests/tests/microformats-v1/hresume/work.json +0 -30
  175. data/vendor/tests/tests/microformats-v1/hreview-aggregate/change-log.html +0 -67
  176. data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.html +0 -18
  177. data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.json +0 -31
  178. data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.html +0 -6
  179. data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.json +0 -19
  180. data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.html +0 -13
  181. data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.json +0 -22
  182. data/vendor/tests/tests/microformats-v1/hreview/change-log.html +0 -73
  183. data/vendor/tests/tests/microformats-v1/hreview/item.html +0 -8
  184. data/vendor/tests/tests/microformats-v1/hreview/item.json +0 -19
  185. data/vendor/tests/tests/microformats-v1/hreview/vcard.html +0 -23
  186. data/vendor/tests/tests/microformats-v1/hreview/vcard.json +0 -58
  187. data/vendor/tests/tests/microformats-v1/includes/change-log.html +0 -72
  188. data/vendor/tests/tests/microformats-v1/includes/hcarditemref.html +0 -16
  189. data/vendor/tests/tests/microformats-v1/includes/hcarditemref.json +0 -49
  190. data/vendor/tests/tests/microformats-v1/includes/heventitemref.html +0 -25
  191. data/vendor/tests/tests/microformats-v1/includes/heventitemref.json +0 -33
  192. data/vendor/tests/tests/microformats-v1/includes/hyperlink.html +0 -18
  193. data/vendor/tests/tests/microformats-v1/includes/hyperlink.json +0 -43
  194. data/vendor/tests/tests/microformats-v1/includes/object.html +0 -23
  195. data/vendor/tests/tests/microformats-v1/includes/object.json +0 -42
  196. data/vendor/tests/tests/microformats-v1/includes/table.html +0 -12
  197. data/vendor/tests/tests/microformats-v1/includes/table.json +0 -19
  198. data/vendor/tests/tests/microformats-v2/h-adr/change-log.html +0 -62
  199. data/vendor/tests/tests/microformats-v2/h-adr/geo.html +0 -10
  200. data/vendor/tests/tests/microformats-v2/h-adr/geo.json +0 -16
  201. data/vendor/tests/tests/microformats-v2/h-adr/geourl.html +0 -4
  202. data/vendor/tests/tests/microformats-v2/h-adr/geourl.json +0 -13
  203. data/vendor/tests/tests/microformats-v2/h-adr/justaname.html +0 -1
  204. data/vendor/tests/tests/microformats-v2/h-adr/justaname.json +0 -10
  205. data/vendor/tests/tests/microformats-v2/h-adr/lettercase.html +0 -21
  206. data/vendor/tests/tests/microformats-v2/h-adr/lettercase.json +0 -12
  207. data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.html +0 -8
  208. data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.json +0 -16
  209. data/vendor/tests/tests/microformats-v2/h-as-note/note.html +0 -56
  210. data/vendor/tests/tests/microformats-v2/h-as-note/note.json +0 -98
  211. data/vendor/tests/tests/microformats-v2/h-card/baseurl.html +0 -6
  212. data/vendor/tests/tests/microformats-v2/h-card/baseurl.json +0 -26
  213. data/vendor/tests/tests/microformats-v2/h-card/change-log.html +0 -100
  214. data/vendor/tests/tests/microformats-v2/h-card/childimplied.html +0 -7
  215. data/vendor/tests/tests/microformats-v2/h-card/childimplied.json +0 -12
  216. data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.html +0 -10
  217. data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.json +0 -15
  218. data/vendor/tests/tests/microformats-v2/h-card/hcard.html +0 -4
  219. data/vendor/tests/tests/microformats-v2/h-card/hcard.json +0 -19
  220. data/vendor/tests/tests/microformats-v2/h-card/horghcard.html +0 -4
  221. data/vendor/tests/tests/microformats-v2/h-card/horghcard.json +0 -19
  222. data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.html +0 -3
  223. data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.json +0 -12
  224. data/vendor/tests/tests/microformats-v2/h-card/impliedname.html +0 -15
  225. data/vendor/tests/tests/microformats-v2/h-card/impliedname.json +0 -90
  226. data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.html +0 -11
  227. data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.json +0 -72
  228. data/vendor/tests/tests/microformats-v2/h-card/impliedurl.html +0 -5
  229. data/vendor/tests/tests/microformats-v2/h-card/impliedurl.json +0 -45
  230. data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.html +0 -1
  231. data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.json +0 -11
  232. data/vendor/tests/tests/microformats-v2/h-card/justaname.html +0 -1
  233. data/vendor/tests/tests/microformats-v2/h-card/justaname.json +0 -10
  234. data/vendor/tests/tests/microformats-v2/h-card/nested.html +0 -4
  235. data/vendor/tests/tests/microformats-v2/h-card/nested.json +0 -18
  236. data/vendor/tests/tests/microformats-v2/h-card/p-property.html +0 -21
  237. data/vendor/tests/tests/microformats-v2/h-card/p-property.json +0 -15
  238. data/vendor/tests/tests/microformats-v2/h-card/relativeurls.html +0 -6
  239. data/vendor/tests/tests/microformats-v2/h-card/relativeurls.json +0 -29
  240. data/vendor/tests/tests/microformats-v2/h-entry/change-log.html +0 -90
  241. data/vendor/tests/tests/microformats-v2/h-entry/encoding.html +0 -3
  242. data/vendor/tests/tests/microformats-v2/h-entry/encoding.json +0 -14
  243. data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.html +0 -9
  244. data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.json +0 -27
  245. data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.html +0 -1
  246. data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.json +0 -11
  247. data/vendor/tests/tests/microformats-v2/h-entry/justaname.html +0 -1
  248. data/vendor/tests/tests/microformats-v2/h-entry/justaname.json +0 -10
  249. data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.html +0 -4
  250. data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.json +0 -14
  251. data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.html +0 -20
  252. data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.json +0 -25
  253. data/vendor/tests/tests/microformats-v2/h-entry/u-property.html +0 -33
  254. data/vendor/tests/tests/microformats-v2/h-entry/u-property.json +0 -12
  255. data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.html +0 -13
  256. data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.json +0 -14
  257. data/vendor/tests/tests/microformats-v2/h-event/ampm.html +0 -41
  258. data/vendor/tests/tests/microformats-v2/h-event/ampm.json +0 -21
  259. data/vendor/tests/tests/microformats-v2/h-event/attendees.html +0 -13
  260. data/vendor/tests/tests/microformats-v2/h-event/attendees.json +0 -37
  261. data/vendor/tests/tests/microformats-v2/h-event/change-log.html +0 -82
  262. data/vendor/tests/tests/microformats-v2/h-event/combining.html +0 -13
  263. data/vendor/tests/tests/microformats-v2/h-event/combining.json +0 -25
  264. data/vendor/tests/tests/microformats-v2/h-event/concatenate.html +0 -8
  265. data/vendor/tests/tests/microformats-v2/h-event/concatenate.json +0 -12
  266. data/vendor/tests/tests/microformats-v2/h-event/dates.html +0 -13
  267. data/vendor/tests/tests/microformats-v2/h-event/dates.json +0 -26
  268. data/vendor/tests/tests/microformats-v2/h-event/dt-property.html +0 -23
  269. data/vendor/tests/tests/microformats-v2/h-event/dt-property.json +0 -20
  270. data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.html +0 -1
  271. data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.json +0 -11
  272. data/vendor/tests/tests/microformats-v2/h-event/justaname.html +0 -1
  273. data/vendor/tests/tests/microformats-v2/h-event/justaname.json +0 -10
  274. data/vendor/tests/tests/microformats-v2/h-event/time.html +0 -47
  275. data/vendor/tests/tests/microformats-v2/h-event/time.json +0 -25
  276. data/vendor/tests/tests/microformats-v2/h-feed/implied-title.html +0 -30
  277. data/vendor/tests/tests/microformats-v2/h-feed/implied-title.json +0 -23
  278. data/vendor/tests/tests/microformats-v2/h-feed/simple.html +0 -26
  279. data/vendor/tests/tests/microformats-v2/h-feed/simple.json +0 -33
  280. data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.html +0 -5
  281. data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.json +0 -12
  282. data/vendor/tests/tests/microformats-v2/h-geo/altitude.html +0 -8
  283. data/vendor/tests/tests/microformats-v2/h-geo/altitude.json +0 -13
  284. data/vendor/tests/tests/microformats-v2/h-geo/change-log.html +0 -67
  285. data/vendor/tests/tests/microformats-v2/h-geo/hidden.html +0 -10
  286. data/vendor/tests/tests/microformats-v2/h-geo/hidden.json +0 -12
  287. data/vendor/tests/tests/microformats-v2/h-geo/justaname.html +0 -3
  288. data/vendor/tests/tests/microformats-v2/h-geo/justaname.json +0 -10
  289. data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.html +0 -5
  290. data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.json +0 -12
  291. data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.html +0 -11
  292. data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.json +0 -12
  293. data/vendor/tests/tests/microformats-v2/h-news/all.html +0 -35
  294. data/vendor/tests/tests/microformats-v2/h-news/all.json +0 -51
  295. data/vendor/tests/tests/microformats-v2/h-news/change-log.html +0 -78
  296. data/vendor/tests/tests/microformats-v2/h-news/minimum.html +0 -24
  297. data/vendor/tests/tests/microformats-v2/h-news/minimum.json +0 -40
  298. data/vendor/tests/tests/microformats-v2/h-org/change-log.html +0 -57
  299. data/vendor/tests/tests/microformats-v2/h-org/hyperlink.html +0 -1
  300. data/vendor/tests/tests/microformats-v2/h-org/hyperlink.json +0 -11
  301. data/vendor/tests/tests/microformats-v2/h-org/simple.html +0 -1
  302. data/vendor/tests/tests/microformats-v2/h-org/simple.json +0 -10
  303. data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.html +0 -4
  304. data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.json +0 -12
  305. data/vendor/tests/tests/microformats-v2/h-product/aggregate.html +0 -21
  306. data/vendor/tests/tests/microformats-v2/h-product/aggregate.json +0 -45
  307. data/vendor/tests/tests/microformats-v2/h-product/change-log.html +0 -62
  308. data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.html +0 -1
  309. data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.json +0 -11
  310. data/vendor/tests/tests/microformats-v2/h-product/justaname.html +0 -1
  311. data/vendor/tests/tests/microformats-v2/h-product/justaname.json +0 -10
  312. data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.html +0 -10
  313. data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.json +0 -26
  314. data/vendor/tests/tests/microformats-v2/h-recipe/all.html +0 -63
  315. data/vendor/tests/tests/microformats-v2/h-recipe/all.json +0 -54
  316. data/vendor/tests/tests/microformats-v2/h-recipe/change-log.html +0 -62
  317. data/vendor/tests/tests/microformats-v2/h-recipe/minimum.html +0 -7
  318. data/vendor/tests/tests/microformats-v2/h-recipe/minimum.json +0 -17
  319. data/vendor/tests/tests/microformats-v2/h-resume/affiliation.html +0 -12
  320. data/vendor/tests/tests/microformats-v2/h-resume/affiliation.json +0 -20
  321. data/vendor/tests/tests/microformats-v2/h-resume/change-log.html +0 -78
  322. data/vendor/tests/tests/microformats-v2/h-resume/contact.html +0 -17
  323. data/vendor/tests/tests/microformats-v2/h-resume/contact.json +0 -26
  324. data/vendor/tests/tests/microformats-v2/h-resume/education.html +0 -13
  325. data/vendor/tests/tests/microformats-v2/h-resume/education.json +0 -30
  326. data/vendor/tests/tests/microformats-v2/h-resume/justaname.html +0 -1
  327. data/vendor/tests/tests/microformats-v2/h-resume/justaname.json +0 -10
  328. data/vendor/tests/tests/microformats-v2/h-resume/skill.html +0 -12
  329. data/vendor/tests/tests/microformats-v2/h-resume/skill.json +0 -12
  330. data/vendor/tests/tests/microformats-v2/h-resume/work.html +0 -16
  331. data/vendor/tests/tests/microformats-v2/h-resume/work.json +0 -31
  332. data/vendor/tests/tests/microformats-v2/h-review-aggregate/change-log.html +0 -78
  333. data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.html +0 -13
  334. data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.json +0 -23
  335. data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.html +0 -8
  336. data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.json +0 -19
  337. data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.html +0 -18
  338. data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.json +0 -26
  339. data/vendor/tests/tests/microformats-v2/h-review/change-log.html +0 -84
  340. data/vendor/tests/tests/microformats-v2/h-review/hyperlink.html +0 -1
  341. data/vendor/tests/tests/microformats-v2/h-review/hyperlink.json +0 -11
  342. data/vendor/tests/tests/microformats-v2/h-review/implieditem.html +0 -4
  343. data/vendor/tests/tests/microformats-v2/h-review/implieditem.json +0 -19
  344. data/vendor/tests/tests/microformats-v2/h-review/item.html +0 -8
  345. data/vendor/tests/tests/microformats-v2/h-review/item.json +0 -20
  346. data/vendor/tests/tests/microformats-v2/h-review/justaname.html +0 -1
  347. data/vendor/tests/tests/microformats-v2/h-review/justaname.json +0 -10
  348. data/vendor/tests/tests/microformats-v2/h-review/photo.html +0 -1
  349. data/vendor/tests/tests/microformats-v2/h-review/photo.json +0 -11
  350. data/vendor/tests/tests/microformats-v2/h-review/vcard.html +0 -23
  351. data/vendor/tests/tests/microformats-v2/h-review/vcard.json +0 -48
  352. data/vendor/tests/tests/microformats-v2/rel/change-log.html +0 -67
  353. data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.html +0 -10
  354. data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.json +0 -75
  355. data/vendor/tests/tests/microformats-v2/rel/license.html +0 -1
  356. data/vendor/tests/tests/microformats-v2/rel/license.json +0 -12
  357. data/vendor/tests/tests/microformats-v2/rel/nofollow.html +0 -1
  358. data/vendor/tests/tests/microformats-v2/rel/nofollow.json +0 -12
  359. data/vendor/tests/tests/microformats-v2/rel/rel-urls.html +0 -8
  360. data/vendor/tests/tests/microformats-v2/rel/rel-urls.json +0 -33
  361. data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.html +0 -4
  362. data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.json +0 -20
  363. data/vendor/tests/tests/microformats-v2/rel/xfn-all.html +0 -19
  364. data/vendor/tests/tests/microformats-v2/rel/xfn-all.json +0 -92
  365. data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.html +0 -10
  366. data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.json +0 -40
@@ -1,7 +1,6 @@
1
1
  module Microformats
2
2
  class PropertyParser < ParserCore
3
-
4
- def parse(element, base: nil, element_type: , format_class_array: [], backcompat: nil)
3
+ def parse(element, base: nil, element_type:, format_class_array: [], backcompat: nil)
5
4
  @base = base
6
5
  @value = nil
7
6
  @property_type = element_type
@@ -13,55 +12,53 @@ module Microformats
13
12
  parse_value_class_pattern(element)
14
13
 
15
14
  if @value.nil?
16
- if element.name == 'abbr' and not element.attribute('title').nil?
17
- @value = element.attribute('title').value.strip
18
- elsif (element.name == 'data' or element.name == 'input') and not element.attribute('value').nil?
19
- @value = element.attribute('value').value.strip
20
- elsif (element.name == 'img' or element.name == 'area') and not element.attribute('alt').nil?
21
- @value = element.attribute('alt').value.strip
22
- else
23
- @value = render_text_and_replace_images(element, base: @base)
24
- end
15
+ @value =
16
+ if element.name == 'abbr' && !element.attribute('title').nil?
17
+ element.attribute('title').value.strip
18
+ elsif element.name == 'link' && !element.attribute('title').nil?
19
+ element.attribute('title').value.strip
20
+ elsif (element.name == 'data' || element.name == 'input') && !element.attribute('value').nil?
21
+ element.attribute('value').value.strip
22
+ elsif (element.name == 'img' || element.name == 'area') && !element.attribute('alt').nil?
23
+ element.attribute('alt').value.strip
24
+ else
25
+ render_text(element, base: @base)
26
+ end
25
27
  end
26
-
27
28
  elsif element_type == 'e'
28
29
  @value = {
29
- value: render_text(element, base: @base), #TODO the spec doesn't say to remove script and style tags, assuming this to be in error
30
- html: element.inner_html.gsub(/\A +/, '').gsub(/ +\Z/, '')
30
+ value: render_text(element, base: @base),
31
+ html: element.inner_html.strip
31
32
  }
32
-
33
33
  elsif element_type == 'u'
34
- if ['a', 'area'].include? element.name and not element.attribute('href').nil?
34
+ if %w[a area link].include?(element.name) && !element.attribute('href').nil?
35
35
  @value = element.attribute('href').value.strip
36
- elsif ['img', 'audio', 'video', 'source'].include? element.name and not element.attribute('src').nil?
36
+ elsif %w[img audio video source].include?(element.name) && !element.attribute('src').nil?
37
37
  @value = element.attribute('src').value.strip
38
- elsif element.name == 'video' and not element.attribute('poster').nil?
38
+ elsif element.name == 'video' && !element.attribute('poster').nil?
39
39
  @value = element.attribute('poster').value.strip
40
- elsif element.name == 'object' and not element.attribute('data').nil?
40
+ elsif element.name == 'object' && !element.attribute('data').nil?
41
41
  @value = element.attribute('data').value.strip
42
42
  end
43
43
 
44
- if not @value.nil?
44
+ if !@value.nil?
45
45
  @value = Microformats::AbsoluteUri.new(@value, base: @base).absolutize
46
46
  else
47
-
48
47
  parse_value_class_pattern(element)
49
48
 
50
49
  if @value.nil?
51
- if element.name == 'abbr' and not element.attribute('title').nil?
52
- @value = element.attribute('title').value.strip
53
- elsif (element.name == 'data' or element.name == 'input') and not element.attribute('value').nil?
54
- @value = element.attribute('value').value.strip
55
- else
56
- @value = render_text(element, base: @base)
57
- end
58
-
50
+ @value =
51
+ if element.name == 'abbr' && !element.attribute('title').nil?
52
+ element.attribute('title').value.strip
53
+ elsif (element.name == 'data' || element.name == 'input') && !element.attribute('value').nil?
54
+ element.attribute('value').value.strip
55
+ else
56
+ render_text(element, base: @base)
57
+ end
59
58
  end
60
59
  end
61
-
62
60
  elsif element_type == 'dt'
63
61
  @value = Microformats::TimePropertyParser.new.parse(element, base: base, element_type: element_type, format_class_array: format_class_array, backcompat: backcompat)
64
-
65
62
  end
66
63
 
67
64
  @value
@@ -69,54 +66,34 @@ module Microformats
69
66
 
70
67
  def parse_value_class_pattern(element)
71
68
  @value_class_pattern_value = []
69
+
72
70
  parse_node(element.children)
71
+
73
72
  @value = @value_class_pattern_value.join unless @value_class_pattern_value.empty?
74
73
  end
75
74
 
76
75
  def parse_element(element)
77
76
  if value_title_classes(element).length >= 1
78
77
  @value_class_pattern_value << element.attribute('title').value.strip
79
-
80
78
  elsif value_classes(element).length >= 1
81
- if element.name == 'img' or element.name == 'area' and not element.attribute('alt').nil?
82
- @value_class_pattern_value << element.attribute('alt').value.strip
83
- elsif element.name == 'data' and not element.attribute('value').nil?
84
- @value_class_pattern_value << element.attribute('value').value.strip
85
- elsif element.name == 'abbr' and not element.attribute('title').nil?
86
- @value_class_pattern_value << element.attribute('title').value.strip
87
- else
88
- @value_class_pattern_value << element.text.strip
89
- end
79
+ @value_class_pattern_value <<
80
+ if element.name == 'img' || element.name == 'area' && !element.attribute('alt').nil?
81
+ element.attribute('alt').value.strip
82
+ elsif element.name == 'data' && !element.attribute('value').nil?
83
+ element.attribute('value').value.strip
84
+ elsif element.name == 'abbr' && !element.attribute('title').nil?
85
+ element.attribute('title').value.strip
86
+ else
87
+ render_and_strip(element.text.strip)
88
+ end
90
89
  else
91
90
  p_classes = property_classes(element)
92
91
  p_classes = backcompat_property_classes(element) if @mode_backcompat
93
- if p_classes.length == 0 and format_classes(element).length == 0
94
- parse_node(element.children)
95
- end
96
- end
97
- end
98
92
 
99
- def render_text_and_replace_images(node, base: nil)
100
- new_doc = Nokogiri::HTML(node.inner_html)
101
- new_doc.xpath('//script').remove
102
- new_doc.xpath('//style').remove
103
- new_doc.traverse do |node|
104
- if node.name == 'img' and not node.attribute('alt').nil?
105
- node.replace(' ' + node.attribute('alt').value.to_s + ' ')
106
- elsif node.name == 'img' and not node.attribute('src').nil?
107
- absolute_url = Microformats::AbsoluteUri.new(node.attribute('src').value.to_s, base: @base).absolutize
108
- node.replace(' ' + absolute_url + ' ')
93
+ if p_classes.empty? && format_classes(element).empty?
94
+ parse_node(element.children)
109
95
  end
110
96
  end
111
- new_doc.text.strip
112
97
  end
113
-
114
- def render_text(node, base: nil)
115
- new_doc = Nokogiri::HTML(node.inner_html)
116
- new_doc.xpath('//script').remove
117
- new_doc.xpath('//style').remove
118
- new_doc.text.strip
119
- end
120
-
121
98
  end
122
99
  end
@@ -1,8 +1,6 @@
1
1
  module Microformats
2
-
3
- #stub to get around the tests for now
2
+ # stub to get around the tests for now
4
3
  class Collection
5
-
6
4
  def initialize(hash)
7
5
  @hash = hash
8
6
  end
@@ -20,21 +18,13 @@ module Microformats
20
18
  end
21
19
 
22
20
  def to_s
23
- if @hash['value']
24
- return @hash['value']
25
- else
26
- super
27
- end
21
+ @hash.to_s
28
22
  end
29
23
 
30
24
  def [](key)
31
25
  @hash[key]
32
26
  end
33
27
 
34
- def value
35
- @hash['value']
36
- end
37
-
38
28
  def items
39
29
  @hash['items'].map do |item|
40
30
  ParserResult.new(item)
@@ -50,19 +40,19 @@ module Microformats
50
40
  end
51
41
 
52
42
  def respond_to?(sym, include_private = false)
53
- has_item?(sym) || super(sym, include_private)
43
+ item?(sym) || super(sym, include_private)
54
44
  end
55
45
 
56
46
  def method_missing(sym, *args, &block)
57
-
58
47
  name = sym.to_s
59
- name_dash = name.gsub('_', '-') if name.include? '_'
48
+ name_dash = name.tr('_', '-') if name.include?('_')
60
49
 
61
- if not @hash['items'].nil?
50
+ unless @hash['items'].nil?
62
51
  result_hash = @hash['items'].select do |x|
63
- x['type'].include?('h-' + name)
52
+ x['type'].include?('h-' + name)
64
53
  end
65
- if result_hash.empty? and not name_dash.nil?
54
+
55
+ if result_hash.empty? && !name_dash.nil?
66
56
  result_hash = @hash['items'].select do |x|
67
57
  x['type'].include?('h-' + name_dash)
68
58
  end
@@ -71,51 +61,42 @@ module Microformats
71
61
 
72
62
  super(sym, *args, &block) if result_hash.empty?
73
63
 
74
- if result_hash.is_a? Array
64
+ if result_hash.is_a?(Array)
75
65
  if args[0].nil?
76
- result_hash = result_hash[0] #will return nil for an empty array
77
-
66
+ result_hash = result_hash[0] # will return nil for an empty array
78
67
  elsif args[0] == :all
79
68
  return result_hash.map do |x|
80
69
  ParserResult.new(x)
81
70
  end
82
-
83
71
  elsif args[0].to_i < result_hash.count
84
72
  result_hash = result_hash[args[0].to_i]
85
-
86
73
  else
87
- result_hash = result_hash[0] #will return nil for an empty array
74
+ result_hash = result_hash[0] # will return nil for an empty array
88
75
  end
89
76
  end
90
77
 
91
- if result_hash.nil? or result_hash.empty?
92
- result_hash
93
- elsif result_hash.is_a? Hash
94
- ParserResult.new(result_hash)
95
- else
96
- result_hash
97
- end
78
+ ParserResult.new(result_hash)
98
79
  end
99
80
 
100
81
  private
101
82
 
102
- def has_item?(name)
83
+ def item?(name)
103
84
  name = name.to_s
104
- name_dash = name.gsub('_', '-') if name.include? '_'
105
- if not @hash['items'].nil?
85
+ name_dash = name.tr('_', '-') if name.include?('_')
86
+
87
+ unless @hash['items'].nil?
106
88
  result_hash = @hash['items'].select do |x|
107
89
  x['type'].include?('h-' + name)
108
90
  end
109
- if result_hash.empty? and not name_dash.nil?
91
+
92
+ if result_hash.empty? && !name_dash.nil?
110
93
  result_hash = @hash['items'].select do |x|
111
94
  x['type'].include?('h-' + name_dash)
112
95
  end
113
96
  end
114
97
  end
115
98
 
116
- not result_hash.empty?
99
+ !result_hash.empty?
117
100
  end
118
-
119
101
  end
120
102
  end
121
-
@@ -1,8 +1,6 @@
1
1
  module Microformats
2
-
3
- #stub to get around the tests for now
2
+ # stub to get around the tests for now
4
3
  class ParserResult
5
-
6
4
  def initialize(hash)
7
5
  @hash = hash
8
6
  end
@@ -20,11 +18,9 @@ module Microformats
20
18
  end
21
19
 
22
20
  def to_s
23
- if @hash['value']
24
- return @hash['value']
25
- else
26
- super
27
- end
21
+ return @hash['value'] if @hash['value']
22
+
23
+ @hash.to_s
28
24
  end
29
25
 
30
26
  def [](key)
@@ -36,54 +32,46 @@ module Microformats
36
32
  end
37
33
 
38
34
  def properties
39
- PropertySet.new( @hash['properties'])
35
+ PropertySet.new(@hash['properties'])
40
36
  end
41
37
 
42
38
  def respond_to?(sym, include_private = false)
43
- has_key?(sym) || has_property?(sym) || super(sym, include_private)
39
+ key?(sym) || property?(sym) || super(sym, include_private)
44
40
  end
45
41
 
46
42
  def method_missing(sym, *args, &block)
47
-
48
43
  name = sym.to_s
49
- name_dash = name.gsub('_', '-') if name.include? '_'
44
+ name_dash = name.tr('_', '-') if name.include?('_')
50
45
 
51
- if not @hash[name].nil?
46
+ if !@hash[name].nil?
52
47
  result_hash = @hash[name]
53
-
54
- elsif not @hash['properties'].nil? and not @hash['properties'][name].nil?
48
+ elsif !@hash['properties'].nil? && !@hash['properties'][name].nil?
55
49
  result_hash = @hash['properties'][name]
56
-
57
- elsif not name_dash.nil? and not @hash[name_dash].nil?
50
+ elsif !name_dash.nil? && !@hash[name_dash].nil?
58
51
  result_hash = @hash[name_dash]
59
-
60
- elsif not name_dash.nil? and not @hash['properties'].nil? and not @hash['properties'][name_dash].nil?
52
+ elsif !name_dash.nil? && !@hash['properties'].nil? && !@hash['properties'][name_dash].nil?
61
53
  result_hash = @hash['properties'][name_dash]
62
-
63
54
  else
64
55
  super(sym, *args, &block)
65
56
  end
66
57
 
67
- if result_hash.is_a? Array
58
+ if result_hash.is_a?(Array)
68
59
  if args[0].nil?
69
- result_hash = result_hash[0] #will return nil for an empty array
70
-
60
+ result_hash = result_hash[0] # will return nil for an empty array
71
61
  elsif args[0] == :all
72
62
  return result_hash.map do |x|
73
63
  ParserResult.new(x)
74
64
  end
75
-
76
65
  elsif args[0].to_i < result_hash.count
77
66
  result_hash = result_hash[args[0].to_i]
78
-
79
67
  else
80
- result_hash = result_hash[0] #will return nil for an empty array
68
+ result_hash = result_hash[0] # will return nil for an empty array
81
69
  end
82
70
  end
83
71
 
84
- if result_hash.nil? or result_hash.empty?
72
+ if result_hash.nil? || result_hash.empty?
85
73
  result_hash
86
- elsif result_hash.is_a? Hash
74
+ elsif result_hash.is_a?(Hash)
87
75
  ParserResult.new(result_hash)
88
76
  else
89
77
  result_hash
@@ -92,20 +80,20 @@ module Microformats
92
80
 
93
81
  private
94
82
 
95
- def has_key?(name)
83
+ def key?(name)
96
84
  name = name.to_s
97
- name_dash = name.gsub('_', '-') if name.include? '_'
85
+ name_dash = name.tr('_', '-') if name.include?('_')
98
86
 
99
- not @hash[name].nil? or not @hash[name_dash].nil?
87
+ !@hash[name].nil? || !@hash[name_dash].nil?
100
88
  end
101
-
102
- def has_property?(name)
89
+
90
+ def property?(name)
103
91
  name = name.to_s
104
- name_dash = name.gsub('_', '-') if name.include? '_'
92
+ name_dash = name.tr('_', '-') if name.include?('_')
93
+
105
94
  return false if @hash['properties'].nil?
106
- not @hash['properties'][name].nil? or not @hash['properties'][name_dash].nil?
107
- end
108
95
 
96
+ !@hash['properties'][name].nil? || !@hash['properties'][name_dash].nil?
97
+ end
109
98
  end
110
99
  end
111
-
@@ -1,8 +1,6 @@
1
1
  module Microformats
2
-
3
- #stub to get around the tests for now
4
- class PropertySet
5
-
2
+ # stub to get around the tests for now
3
+ class PropertySet
6
4
  def initialize(hash)
7
5
  @hash = hash
8
6
  end
@@ -23,65 +21,60 @@ module Microformats
23
21
  @hash[key]
24
22
  end
25
23
 
26
- def respond_to?(sym, include_private = false)
27
- has_key?(sym) || super(sym, include_private)
24
+ def to_s
25
+ @hash.to_s
28
26
  end
29
27
 
28
+ def respond_to?(sym, include_private = false)
29
+ key?(sym) || super(sym, include_private)
30
+ end
30
31
 
31
32
  def method_missing(mname, *args, &block)
33
+ if respond_to?(mname)
34
+ result_hash = val?(mname)
32
35
 
33
- if respond_to? mname
34
- result_hash = get_val? mname
35
- if result_hash.is_a? Array
36
+ if result_hash.is_a?(Array)
36
37
  if args[0].nil?
37
- result_hash = result_hash[0] #will return nil for an empty array
38
-
38
+ result_hash = result_hash[0] # will return nil for an empty array
39
39
  elsif args[0] == :all
40
40
  return result_hash.map do |x|
41
41
  ParserResult.new(x)
42
42
  end
43
-
44
43
  elsif args[0].to_i < result_hash.count
45
44
  result_hash = result_hash[args[0].to_i]
46
-
47
45
  else
48
- result_hash = result_hash[0] #will return nil for an empty array
46
+ result_hash = result_hash[0] # will return nil for an empty array
49
47
  end
50
48
  end
51
49
 
52
- if result_hash.is_a? Hash
50
+ if result_hash.is_a?(Hash)
53
51
  ParserResult.new(result_hash)
54
52
  else
55
53
  result_hash
56
54
  end
57
55
  else
58
- super(mname, *args, &block)
56
+ super(mname, *args, &block)
59
57
  end
60
-
61
58
  end
62
59
 
63
60
  private
64
61
 
65
- def has_key?(name)
62
+ def key?(name)
66
63
  name = name.to_s
67
- name_dash = name.gsub('_', '-') if name.include? '_'
68
- not @hash[name].nil? or not @hash[name_dash].nil?
64
+ name_dash = name.tr('_', '-') if name.include?('_')
65
+
66
+ !@hash[name].nil? || !@hash[name_dash].nil?
69
67
  end
70
68
 
71
- def get_val?(name)
69
+ def val?(name)
72
70
  name = name.to_s
73
- name_dash = name.gsub('_', '-') if name.include? '_'
74
-
75
- if not @hash[name].nil?
76
- result_hash = @hash[name]
71
+ name_dash = name.tr('_', '-') if name.include?('_')
77
72
 
78
- elsif not @hash[name_dash].nil?
79
- result_hash = @hash[name_dash]
80
- else
81
- nil
73
+ if !@hash[name].nil?
74
+ @hash[name]
75
+ elsif !@hash[name_dash].nil?
76
+ @hash[name_dash]
82
77
  end
83
78
  end
84
-
85
79
  end
86
80
  end
87
-