brakeman 4.4.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (732) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +271 -107
  3. data/README.md +19 -12
  4. data/bundle/load.rb +14 -14
  5. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/CHANGES.txt +0 -0
  6. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/MIT-LICENSE +0 -0
  7. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/README.txt +0 -0
  8. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/contrib/erubis +0 -0
  9. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/contrib/erubis-run.rb +0 -0
  10. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/contrib/inline-require +0 -0
  11. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis.rb +0 -0
  12. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/context.rb +0 -0
  13. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/converter.rb +0 -0
  14. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine.rb +0 -0
  15. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ec.rb +0 -0
  16. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ecpp.rb +0 -0
  17. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ejava.rb +0 -0
  18. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ejavascript.rb +0 -0
  19. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/enhanced.rb +0 -0
  20. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/eperl.rb +0 -0
  21. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb +0 -0
  22. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/eruby.rb +0 -0
  23. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/escheme.rb +0 -0
  24. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/optimized.rb +0 -0
  25. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/enhancer.rb +0 -0
  26. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/error.rb +0 -0
  27. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/evaluator.rb +0 -0
  28. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/generator.rb +0 -0
  29. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helper.rb +0 -0
  30. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb +0 -0
  31. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_helper.rb +0 -0
  32. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/local-setting.rb +0 -0
  33. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/main.rb +0 -0
  34. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/preprocessing.rb +0 -0
  35. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/tiny.rb +0 -0
  36. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/util.rb +0 -0
  37. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/setup.rb +0 -0
  38. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/CHANGELOG.md +138 -4
  39. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/FAQ.md +4 -14
  40. data/bundle/ruby/2.7.0/gems/haml-5.2.1/Gemfile +16 -0
  41. data/bundle/ruby/{2.5.0/gems/sass-3.4.25/vendor/listen/LICENSE → 2.7.0/gems/haml-5.2.1/MIT-LICENSE} +1 -1
  42. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/README.md +79 -42
  43. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/REFERENCE.md +150 -71
  44. data/bundle/ruby/2.7.0/gems/haml-5.2.1/TODO +24 -0
  45. data/bundle/ruby/2.7.0/gems/haml-5.2.1/haml.gemspec +45 -0
  46. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml.rb +2 -0
  47. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/attribute_builder.rb +164 -0
  48. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/attribute_compiler.rb +235 -0
  49. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/attribute_parser.rb +150 -0
  50. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/buffer.rb +25 -132
  51. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/compiler.rb +330 -0
  52. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/engine.rb +34 -41
  53. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/error.rb +65 -0
  54. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/escapable.rb +77 -0
  55. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/exec.rb +38 -20
  56. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/filters.rb +22 -27
  57. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/generator.rb +42 -0
  58. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers.rb +134 -89
  59. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/action_view_extensions.rb +4 -2
  60. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/action_view_mods.rb +45 -60
  61. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/action_view_xss_mods.rb +2 -0
  62. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/helpers/safe_erubi_template.rb +20 -0
  63. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/safe_erubis_template.rb +5 -1
  64. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/xss_mods.rb +23 -13
  65. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/options.rb +63 -69
  66. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/parser.rb +319 -227
  67. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/plugin.rb +37 -0
  68. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/railtie.rb +48 -0
  69. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/sass_rails_filter.rb +18 -4
  70. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/template.rb +13 -6
  71. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/template/options.rb +13 -2
  72. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/temple_engine.rb +123 -0
  73. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/temple_line_counter.rb +30 -0
  74. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/util.rb +258 -0
  75. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/version.rb +5 -0
  76. data/bundle/ruby/2.7.0/gems/haml-5.2.1/yard/default/fulldoc/html/css/common.sass +15 -0
  77. data/bundle/ruby/2.7.0/gems/haml-5.2.1/yard/default/layout/html/footer.erb +12 -0
  78. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/AUTHORS +0 -0
  79. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/COPYING +0 -0
  80. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/Changelog.md +214 -15
  81. data/bundle/ruby/2.7.0/gems/highline-2.0.3/Gemfile +22 -0
  82. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/LICENSE +0 -0
  83. data/bundle/ruby/2.7.0/gems/highline-2.0.3/README.md +202 -0
  84. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/TODO +0 -0
  85. data/bundle/ruby/2.7.0/gems/highline-2.0.3/appveyor.yml +37 -0
  86. data/bundle/ruby/2.7.0/gems/highline-2.0.3/highline.gemspec +35 -0
  87. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline.rb +650 -0
  88. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/builtin_styles.rb +129 -0
  89. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/lib/highline/color_scheme.rb +49 -32
  90. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/compatibility.rb +23 -0
  91. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/custom_errors.rb +57 -0
  92. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/import.rb +48 -0
  93. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/io_console_compatible.rb +37 -0
  94. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/list.rb +177 -0
  95. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/list_renderer.rb +261 -0
  96. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/menu.rb +576 -0
  97. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/menu/item.rb +32 -0
  98. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/paginator.rb +52 -0
  99. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/lib/highline/question.rb +281 -131
  100. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/question/answer_converter.rb +103 -0
  101. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/question_asker.rb +150 -0
  102. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/simulate.rb +59 -0
  103. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/statement.rb +88 -0
  104. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/string.rb +36 -0
  105. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/string_extensions.rb +130 -0
  106. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/style.rb +325 -0
  107. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/template_renderer.rb +62 -0
  108. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/terminal.rb +190 -0
  109. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/terminal/io_console.rb +36 -0
  110. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/terminal/ncurses.rb +38 -0
  111. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/terminal/unix_stty.rb +51 -0
  112. data/bundle/ruby/{2.5.0/gems/highline-1.7.10 → 2.7.0/gems/highline-2.0.3}/lib/highline/version.rb +3 -1
  113. data/bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/wrapper.rb +53 -0
  114. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/Gemfile +6 -0
  115. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/LICENSE.txt +22 -0
  116. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/NEWS.md +141 -0
  117. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/README.md +60 -0
  118. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/attlistdecl.rb +63 -0
  119. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/attribute.rb +205 -0
  120. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/cdata.rb +68 -0
  121. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/child.rb +97 -0
  122. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/comment.rb +80 -0
  123. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/doctype.rb +287 -0
  124. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/document.rb +291 -0
  125. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/attlistdecl.rb +11 -0
  126. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/dtd.rb +47 -0
  127. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/elementdecl.rb +18 -0
  128. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/entitydecl.rb +57 -0
  129. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/notationdecl.rb +40 -0
  130. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/element.rb +1269 -0
  131. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/encoding.rb +51 -0
  132. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/entity.rb +171 -0
  133. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/formatters/default.rb +116 -0
  134. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/formatters/pretty.rb +142 -0
  135. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/formatters/transitive.rb +58 -0
  136. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/functions.rb +447 -0
  137. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/instruction.rb +79 -0
  138. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/light/node.rb +196 -0
  139. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/namespace.rb +59 -0
  140. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/node.rb +76 -0
  141. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/output.rb +30 -0
  142. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parent.rb +166 -0
  143. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parseexception.rb +52 -0
  144. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/baseparser.rb +594 -0
  145. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/lightparser.rb +59 -0
  146. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/pullparser.rb +197 -0
  147. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/sax2parser.rb +273 -0
  148. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/streamparser.rb +61 -0
  149. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/treeparser.rb +101 -0
  150. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/ultralightparser.rb +57 -0
  151. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/xpathparser.rb +675 -0
  152. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/quickpath.rb +266 -0
  153. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/rexml.rb +32 -0
  154. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/sax2listener.rb +98 -0
  155. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/security.rb +28 -0
  156. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/source.rb +298 -0
  157. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/streamlistener.rb +93 -0
  158. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/text.rb +424 -0
  159. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/undefinednamespaceexception.rb +9 -0
  160. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/validation/relaxng.rb +539 -0
  161. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/validation/validation.rb +144 -0
  162. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/validation/validationexception.rb +10 -0
  163. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xmldecl.rb +130 -0
  164. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xmltokens.rb +85 -0
  165. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xpath.rb +81 -0
  166. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xpath_parser.rb +968 -0
  167. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/rexml.gemspec +84 -0
  168. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.1 → 2.7.0/gems/ruby2ruby-2.4.4}/History.rdoc +22 -0
  169. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.1 → 2.7.0/gems/ruby2ruby-2.4.4}/Manifest.txt +0 -0
  170. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.1 → 2.7.0/gems/ruby2ruby-2.4.4}/README.rdoc +0 -0
  171. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.1 → 2.7.0/gems/ruby2ruby-2.4.4}/lib/ruby2ruby.rb +118 -110
  172. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/History.rdoc +176 -0
  173. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/Manifest.txt +7 -4
  174. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/README.rdoc +3 -3
  175. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/compare/normalize.rb +69 -2
  176. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/debugging.md +57 -0
  177. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/rp_extensions.rb +1 -8
  178. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/rp_stringscanner.rb +0 -0
  179. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby20_parser.rb +7062 -0
  180. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib/ruby_parser.yy → 2.7.0/gems/ruby_parser-3.15.1/lib/ruby20_parser.y} +728 -604
  181. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby21_parser.rb +7140 -0
  182. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/ruby21_parser.y +734 -472
  183. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby22_parser.rb +7160 -0
  184. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/ruby22_parser.y +735 -478
  185. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby23_parser.rb +7175 -0
  186. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/ruby23_parser.y +736 -479
  187. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby24_parser.rb +7204 -0
  188. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/ruby24_parser.y +742 -477
  189. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby25_parser.rb +7204 -0
  190. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/ruby25_parser.y +742 -477
  191. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby26_parser.rb +7224 -0
  192. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby26_parser.y +2657 -0
  193. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby27_parser.rb +7224 -0
  194. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby27_parser.y +2657 -0
  195. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby_lexer.rb +1473 -0
  196. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby_lexer.rex +178 -0
  197. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby_lexer.rex.rb +363 -0
  198. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0 → 2.7.0/gems/ruby_parser-3.15.1}/lib/ruby_parser.rb +36 -34
  199. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby_parser.yy +2764 -0
  200. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby_parser_extras.rb +1631 -0
  201. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/tools/munge.rb +222 -0
  202. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/tools/ripper.rb +39 -0
  203. data/bundle/ruby/2.7.0/gems/ruby_parser-legacy-1.0.0/History.rdoc +6 -0
  204. data/bundle/ruby/2.7.0/gems/ruby_parser-legacy-1.0.0/Manifest.txt +19 -0
  205. data/bundle/ruby/2.7.0/gems/ruby_parser-legacy-1.0.0/README.rdoc +54 -0
  206. data/bundle/ruby/2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy.rb +5 -0
  207. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.rb +7 -6
  208. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.y +5 -4
  209. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.rb +7 -6
  210. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.y +5 -4
  211. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby_lexer.rb +117 -64
  212. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby_lexer.rex +11 -9
  213. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby_lexer.rex.rb +10 -10
  214. data/bundle/ruby/2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser.rb +30 -0
  215. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.12.0/lib → 2.7.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby_parser_extras.rb +43 -33
  216. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/CHANGES.md +5 -0
  217. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/Gemfile +0 -0
  218. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/LICENSE.txt +0 -0
  219. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/README.md +0 -0
  220. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/bundle_install_all_ruby_versions.sh +0 -0
  221. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml.rb +0 -0
  222. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/deep.rb +0 -0
  223. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/libyaml_checker.rb +0 -0
  224. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/load.rb +0 -0
  225. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/parse/date.rb +2 -0
  226. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/parse/hexadecimal.rb +0 -0
  227. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/parse/sexagesimal.rb +0 -0
  228. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/psych_handler.rb +0 -0
  229. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/psych_resolver.rb +0 -0
  230. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/resolver.rb +0 -0
  231. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -0
  232. data/bundle/ruby/2.7.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb +39 -0
  233. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/syck_hack.rb +0 -0
  234. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/syck_node_monkeypatch.rb +0 -0
  235. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/syck_resolver.rb +0 -0
  236. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform.rb +0 -0
  237. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform/to_boolean.rb +0 -0
  238. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform/to_date.rb +0 -0
  239. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform/to_float.rb +0 -0
  240. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform/to_integer.rb +0 -0
  241. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform/to_nil.rb +0 -0
  242. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform/to_symbol.rb +0 -0
  243. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/transform/transformation_map.rb +0 -0
  244. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/lib/safe_yaml/version.rb +1 -1
  245. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/run_specs_all_ruby_versions.sh +0 -0
  246. data/bundle/ruby/{2.5.0/gems/safe_yaml-1.0.4 → 2.7.0/gems/safe_yaml-1.0.5}/safe_yaml.gemspec +0 -0
  247. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/History.rdoc +67 -0
  248. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/Manifest.txt +1 -0
  249. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/README.rdoc +0 -0
  250. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/lib/composite_sexp_processor.rb +0 -0
  251. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/lib/pt_testcase.rb +15 -17
  252. data/bundle/ruby/2.7.0/gems/sexp_processor-4.15.2/lib/sexp.rb +381 -0
  253. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0/lib/sexp.rb → 2.7.0/gems/sexp_processor-4.15.2/lib/sexp_matcher.rb} +67 -387
  254. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/lib/sexp_processor.rb +2 -2
  255. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/lib/strict_sexp.rb +3 -3
  256. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.11.0 → 2.7.0/gems/sexp_processor-4.15.2}/lib/unique.rb +0 -0
  257. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/CHANGES +4 -0
  258. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/Gemfile +12 -13
  259. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/LICENSE +0 -0
  260. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/README.jp.md +0 -0
  261. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/README.md +0 -0
  262. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim.rb +0 -0
  263. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/code_attributes.rb +0 -0
  264. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/command.rb +13 -13
  265. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/controls.rb +0 -0
  266. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/do_inserter.rb +0 -0
  267. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/embedded.rb +0 -0
  268. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/end_inserter.rb +0 -0
  269. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/engine.rb +0 -0
  270. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/erb_converter.rb +0 -0
  271. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/filter.rb +0 -0
  272. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/grammar.rb +0 -0
  273. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/include.rb +0 -0
  274. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/interpolation.rb +0 -0
  275. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less.rb +0 -0
  276. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less/context.rb +0 -0
  277. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less/filter.rb +0 -0
  278. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/parser.rb +1 -1
  279. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart.rb +0 -0
  280. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/escaper.rb +0 -0
  281. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/filter.rb +0 -0
  282. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/parser.rb +0 -0
  283. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/splat/builder.rb +0 -0
  284. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/splat/filter.rb +0 -0
  285. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/template.rb +0 -0
  286. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/translator.rb +0 -0
  287. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/version.rb +1 -1
  288. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/slim.gemspec +0 -0
  289. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/CHANGES +11 -0
  290. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/EXPRESSIONS.md +1 -1
  291. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/Gemfile +0 -0
  292. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/LICENSE +0 -0
  293. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/README.md +1 -1
  294. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple.rb +0 -0
  295. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/engine.rb +0 -0
  296. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/engine.rb +0 -0
  297. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/parser.rb +0 -0
  298. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/template.rb +0 -0
  299. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/trimming.rb +0 -0
  300. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/exceptions.rb +0 -0
  301. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filter.rb +0 -0
  302. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/code_merger.rb +0 -0
  303. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/control_flow.rb +0 -0
  304. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/dynamic_inliner.rb +0 -0
  305. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/encoding.rb +0 -0
  306. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/eraser.rb +0 -0
  307. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/escapable.rb +0 -0
  308. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/multi_flattener.rb +0 -0
  309. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/remove_bom.rb +0 -0
  310. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/static_analyzer.rb +0 -0
  311. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/static_merger.rb +0 -0
  312. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/string_splitter.rb +1 -1
  313. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/validator.rb +0 -0
  314. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/generator.rb +0 -0
  315. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/array.rb +0 -0
  316. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/array_buffer.rb +0 -0
  317. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/erb.rb +0 -0
  318. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/rails_output_buffer.rb +0 -0
  319. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/string_buffer.rb +0 -0
  320. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/grammar.rb +0 -0
  321. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/attribute_merger.rb +0 -0
  322. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/attribute_remover.rb +0 -0
  323. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/attribute_sorter.rb +0 -0
  324. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/dispatcher.rb +0 -0
  325. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/fast.rb +0 -0
  326. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/filter.rb +0 -0
  327. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/pretty.rb +0 -0
  328. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/safe.rb +0 -0
  329. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/map.rb +0 -0
  330. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/dispatcher.rb +2 -1
  331. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/engine_dsl.rb +0 -0
  332. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/grammar_dsl.rb +0 -0
  333. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/options.rb +0 -0
  334. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/template.rb +0 -0
  335. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/parser.rb +0 -0
  336. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/static_analyzer.rb +1 -1
  337. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/templates.rb +0 -0
  338. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/templates/rails.rb +2 -2
  339. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/templates/tilt.rb +0 -0
  340. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/lib/temple/utils.rb +0 -0
  341. data/bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/version.rb +3 -0
  342. data/bundle/ruby/{2.5.0/gems/temple-0.8.0 → 2.7.0/gems/temple-0.8.2}/temple.gemspec +0 -0
  343. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/Gemfile +0 -0
  344. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/History.rdoc +0 -0
  345. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/LICENSE.txt +0 -0
  346. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/Manifest +0 -0
  347. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/README.rdoc +0 -0
  348. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/Todo.rdoc +0 -0
  349. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table.rb +0 -0
  350. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb +0 -0
  351. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/import.rb +0 -0
  352. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/row.rb +0 -0
  353. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb +0 -0
  354. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/style.rb +0 -0
  355. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/table.rb +0 -0
  356. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/table_helper.rb +0 -0
  357. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/version.rb +0 -0
  358. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/terminal-table.gemspec +0 -0
  359. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/COPYING +0 -0
  360. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt.rb +1 -1
  361. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/asciidoc.rb +0 -0
  362. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/babel.rb +0 -0
  363. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/bluecloth.rb +0 -0
  364. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/builder.rb +0 -0
  365. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/coffee.rb +0 -0
  366. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/commonmarker.rb +0 -0
  367. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/creole.rb +0 -0
  368. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/csv.rb +0 -0
  369. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/dummy.rb +0 -0
  370. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/erb.rb +0 -0
  371. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/erubi.rb +0 -0
  372. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/erubis.rb +0 -0
  373. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/etanni.rb +0 -0
  374. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/haml.rb +0 -0
  375. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/kramdown.rb +0 -0
  376. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/less.rb +0 -0
  377. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/liquid.rb +0 -0
  378. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/livescript.rb +0 -0
  379. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/mapping.rb +0 -0
  380. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/markaby.rb +0 -0
  381. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/maruku.rb +0 -0
  382. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/nokogiri.rb +0 -0
  383. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/pandoc.rb +0 -0
  384. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/plain.rb +0 -0
  385. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/prawn.rb +0 -0
  386. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/radius.rb +0 -0
  387. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/rdiscount.rb +0 -0
  388. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/rdoc.rb +0 -0
  389. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/redcarpet.rb +0 -0
  390. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/redcloth.rb +0 -0
  391. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/rst-pandoc.rb +0 -0
  392. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/sass.rb +0 -0
  393. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/sigil.rb +0 -0
  394. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/string.rb +0 -0
  395. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/template.rb +7 -12
  396. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/typescript.rb +0 -0
  397. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/wikicloth.rb +0 -0
  398. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/yajl.rb +0 -0
  399. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/CHANGELOG.md +16 -0
  400. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/MIT-LICENSE.txt +1 -1
  401. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/README.md +10 -10
  402. data/bundle/ruby/2.7.0/gems/unicode-display_width-1.7.0/data/display_width.marshal.gz +0 -0
  403. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width.rb +1 -1
  404. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/constants.rb +2 -2
  405. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/index.rb +0 -0
  406. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
  407. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.4.1 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/string_ext.rb +0 -0
  408. data/lib/brakeman.rb +37 -0
  409. data/lib/brakeman/app_tree.rb +67 -22
  410. data/lib/brakeman/call_index.rb +54 -15
  411. data/lib/brakeman/checks.rb +7 -7
  412. data/lib/brakeman/checks/base_check.rb +94 -66
  413. data/lib/brakeman/checks/check_basic_auth.rb +2 -0
  414. data/lib/brakeman/checks/check_content_tag.rb +12 -1
  415. data/lib/brakeman/checks/check_cookie_serialization.rb +22 -0
  416. data/lib/brakeman/checks/check_cross_site_scripting.rb +15 -10
  417. data/lib/brakeman/checks/check_csrf_token_forgery_cve.rb +28 -0
  418. data/lib/brakeman/checks/check_default_routes.rb +5 -0
  419. data/lib/brakeman/checks/check_deserialize.rb +70 -1
  420. data/lib/brakeman/checks/check_dynamic_finders.rb +1 -1
  421. data/lib/brakeman/checks/check_evaluation.rb +0 -1
  422. data/lib/brakeman/checks/check_execute.rb +84 -5
  423. data/lib/brakeman/checks/check_file_access.rb +7 -1
  424. data/lib/brakeman/checks/check_force_ssl.rb +27 -0
  425. data/lib/brakeman/checks/check_header_dos.rb +2 -2
  426. data/lib/brakeman/checks/check_i18n_xss.rb +2 -2
  427. data/lib/brakeman/checks/check_jruby_xml.rb +2 -2
  428. data/lib/brakeman/checks/check_json_entity_escape.rb +38 -0
  429. data/lib/brakeman/checks/check_json_parsing.rb +7 -2
  430. data/lib/brakeman/checks/check_link_to.rb +1 -1
  431. data/lib/brakeman/checks/check_link_to_href.rb +7 -4
  432. data/lib/brakeman/checks/check_mail_to.rb +1 -1
  433. data/lib/brakeman/checks/check_mass_assignment.rb +34 -4
  434. data/lib/brakeman/checks/check_mime_type_dos.rb +2 -2
  435. data/lib/brakeman/checks/check_model_attr_accessible.rb +2 -2
  436. data/lib/brakeman/checks/check_model_attributes.rb +13 -51
  437. data/lib/brakeman/checks/check_model_serialize.rb +1 -1
  438. data/lib/brakeman/checks/check_nested_attributes_bypass.rb +4 -4
  439. data/lib/brakeman/checks/check_page_caching_cve.rb +37 -0
  440. data/lib/brakeman/checks/check_permit_attributes.rb +1 -1
  441. data/lib/brakeman/checks/check_regex_dos.rb +1 -1
  442. data/lib/brakeman/checks/check_reverse_tabnabbing.rb +58 -0
  443. data/lib/brakeman/checks/check_sanitize_methods.rb +2 -2
  444. data/lib/brakeman/checks/check_secrets.rb +1 -1
  445. data/lib/brakeman/checks/check_send.rb +0 -1
  446. data/lib/brakeman/checks/check_session_manipulation.rb +0 -1
  447. data/lib/brakeman/checks/check_session_settings.rb +15 -12
  448. data/lib/brakeman/checks/check_simple_format.rb +5 -0
  449. data/lib/brakeman/checks/check_skip_before_filter.rb +5 -5
  450. data/lib/brakeman/checks/check_sql.rb +46 -48
  451. data/lib/brakeman/checks/check_template_injection.rb +32 -0
  452. data/lib/brakeman/checks/check_unsafe_reflection_methods.rb +68 -0
  453. data/lib/brakeman/checks/check_validation_regex.rb +1 -1
  454. data/lib/brakeman/checks/check_verb_confusion.rb +75 -0
  455. data/lib/brakeman/checks/check_xml_dos.rb +2 -2
  456. data/lib/brakeman/checks/check_yaml_parsing.rb +10 -18
  457. data/lib/brakeman/commandline.rb +25 -1
  458. data/lib/brakeman/differ.rb +16 -33
  459. data/lib/brakeman/file_parser.rb +25 -21
  460. data/lib/brakeman/file_path.rb +85 -0
  461. data/lib/brakeman/options.rb +32 -1
  462. data/lib/brakeman/parsers/haml_embedded.rb +44 -0
  463. data/lib/brakeman/parsers/slim_embedded.rb +44 -0
  464. data/lib/brakeman/parsers/template_parser.rb +9 -10
  465. data/lib/brakeman/processor.rb +5 -6
  466. data/lib/brakeman/processors/alias_processor.rb +71 -14
  467. data/lib/brakeman/processors/base_processor.rb +10 -7
  468. data/lib/brakeman/processors/controller_alias_processor.rb +10 -7
  469. data/lib/brakeman/processors/controller_processor.rb +10 -14
  470. data/lib/brakeman/processors/gem_processor.rb +10 -2
  471. data/lib/brakeman/processors/haml_template_processor.rb +99 -123
  472. data/lib/brakeman/processors/lib/call_conversion_helper.rb +10 -5
  473. data/lib/brakeman/processors/lib/file_type_detector.rb +64 -0
  474. data/lib/brakeman/processors/lib/find_all_calls.rb +57 -18
  475. data/lib/brakeman/processors/lib/find_call.rb +3 -64
  476. data/lib/brakeman/processors/lib/module_helper.rb +8 -8
  477. data/lib/brakeman/processors/lib/processor_helper.rb +3 -3
  478. data/lib/brakeman/processors/lib/rails2_config_processor.rb +4 -4
  479. data/lib/brakeman/processors/lib/rails2_route_processor.rb +2 -2
  480. data/lib/brakeman/processors/lib/rails3_config_processor.rb +19 -19
  481. data/lib/brakeman/processors/lib/rails3_route_processor.rb +2 -2
  482. data/lib/brakeman/processors/lib/render_helper.rb +5 -3
  483. data/lib/brakeman/processors/lib/render_path.rb +18 -1
  484. data/lib/brakeman/processors/library_processor.rb +5 -5
  485. data/lib/brakeman/processors/model_processor.rb +4 -5
  486. data/lib/brakeman/processors/output_processor.rb +6 -1
  487. data/lib/brakeman/processors/slim_template_processor.rb +16 -0
  488. data/lib/brakeman/processors/template_alias_processor.rb +36 -4
  489. data/lib/brakeman/processors/template_processor.rb +14 -10
  490. data/lib/brakeman/report.rb +22 -4
  491. data/lib/brakeman/report/ignore/config.rb +12 -5
  492. data/lib/brakeman/report/ignore/interactive.rb +2 -2
  493. data/lib/brakeman/report/pager.rb +1 -0
  494. data/lib/brakeman/report/report_base.rb +51 -8
  495. data/lib/brakeman/report/report_codeclimate.rb +3 -3
  496. data/lib/brakeman/report/report_csv.rb +37 -60
  497. data/lib/brakeman/report/report_hash.rb +1 -1
  498. data/lib/brakeman/report/report_html.rb +2 -2
  499. data/lib/brakeman/report/report_json.rb +1 -24
  500. data/lib/brakeman/report/report_junit.rb +104 -0
  501. data/lib/brakeman/report/report_markdown.rb +0 -1
  502. data/lib/brakeman/report/report_sarif.rb +114 -0
  503. data/lib/brakeman/report/report_sonar.rb +38 -0
  504. data/lib/brakeman/report/report_table.rb +20 -4
  505. data/lib/brakeman/report/report_tabs.rb +1 -1
  506. data/lib/brakeman/report/report_text.rb +43 -23
  507. data/lib/brakeman/rescanner.rb +18 -15
  508. data/lib/brakeman/scanner.rb +70 -35
  509. data/lib/brakeman/tracker.rb +44 -8
  510. data/lib/brakeman/tracker/collection.rb +4 -3
  511. data/lib/brakeman/tracker/config.rb +119 -47
  512. data/lib/brakeman/tracker/constants.rb +10 -8
  513. data/lib/brakeman/tracker/controller.rb +1 -1
  514. data/lib/brakeman/util.rb +45 -151
  515. data/lib/brakeman/version.rb +1 -1
  516. data/lib/brakeman/warning.rb +37 -15
  517. data/lib/brakeman/warning_codes.rb +13 -0
  518. data/lib/ruby_parser/bm_sexp.rb +16 -11
  519. data/lib/ruby_parser/bm_sexp_processor.rb +1 -0
  520. metadata +434 -497
  521. data/bundle/ruby/2.5.0/gems/haml-4.0.7/MIT-LICENSE +0 -20
  522. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/compiler.rb +0 -540
  523. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/error.rb +0 -61
  524. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/railtie.rb +0 -22
  525. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/template/plugin.rb +0 -41
  526. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/util.rb +0 -377
  527. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/version.rb +0 -3
  528. data/bundle/ruby/2.5.0/gems/highline-1.7.10/Gemfile +0 -11
  529. data/bundle/ruby/2.5.0/gems/highline-1.7.10/INSTALL +0 -59
  530. data/bundle/ruby/2.5.0/gems/highline-1.7.10/README.rdoc +0 -74
  531. data/bundle/ruby/2.5.0/gems/highline-1.7.10/highline.gemspec +0 -37
  532. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline.rb +0 -1048
  533. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline/compatibility.rb +0 -16
  534. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline/import.rb +0 -41
  535. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline/menu.rb +0 -381
  536. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline/simulate.rb +0 -48
  537. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline/string_extensions.rb +0 -111
  538. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline/style.rb +0 -192
  539. data/bundle/ruby/2.5.0/gems/highline-1.7.10/lib/highline/system_extensions.rb +0 -254
  540. data/bundle/ruby/2.5.0/gems/highline-1.7.10/setup.rb +0 -1360
  541. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby20_parser.rb +0 -6687
  542. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby20_parser.y +0 -2345
  543. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby21_parser.rb +0 -6767
  544. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby22_parser.rb +0 -6803
  545. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby23_parser.rb +0 -6818
  546. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby24_parser.rb +0 -6818
  547. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby25_parser.rb +0 -6818
  548. data/bundle/ruby/2.5.0/gems/sass-3.4.25/CODE_OF_CONDUCT.md +0 -10
  549. data/bundle/ruby/2.5.0/gems/sass-3.4.25/CONTRIBUTING.md +0 -148
  550. data/bundle/ruby/2.5.0/gems/sass-3.4.25/MIT-LICENSE +0 -20
  551. data/bundle/ruby/2.5.0/gems/sass-3.4.25/README.md +0 -227
  552. data/bundle/ruby/2.5.0/gems/sass-3.4.25/REVISION +0 -1
  553. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION +0 -1
  554. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_DATE +0 -1
  555. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_NAME +0 -1
  556. data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/sass-spec-ref.sh +0 -32
  557. data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/update_watch.rb +0 -13
  558. data/bundle/ruby/2.5.0/gems/sass-3.4.25/init.rb +0 -18
  559. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass.rb +0 -109
  560. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores.rb +0 -15
  561. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/base.rb +0 -88
  562. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/chain.rb +0 -34
  563. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/filesystem.rb +0 -60
  564. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/memory.rb +0 -46
  565. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/null.rb +0 -25
  566. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/callbacks.rb +0 -67
  567. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/css.rb +0 -408
  568. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/deprecation.rb +0 -55
  569. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/engine.rb +0 -1226
  570. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/environment.rb +0 -215
  571. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/error.rb +0 -198
  572. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec.rb +0 -9
  573. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/base.rb +0 -199
  574. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_convert.rb +0 -283
  575. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb +0 -440
  576. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/features.rb +0 -47
  577. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers.rb +0 -23
  578. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/base.rb +0 -182
  579. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/deprecated_path.rb +0 -51
  580. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/filesystem.rb +0 -219
  581. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger.rb +0 -17
  582. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/base.rb +0 -36
  583. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/delayed.rb +0 -50
  584. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/log_level.rb +0 -45
  585. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/media.rb +0 -210
  586. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin.rb +0 -134
  587. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb +0 -582
  588. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/configuration.rb +0 -134
  589. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/generic.rb +0 -15
  590. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/merb.rb +0 -48
  591. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rack.rb +0 -60
  592. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rails.rb +0 -47
  593. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/staleness_checker.rb +0 -199
  594. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/railtie.rb +0 -10
  595. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/repl.rb +0 -57
  596. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/root.rb +0 -7
  597. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script.rb +0 -66
  598. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_lexer.rb +0 -33
  599. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_parser.rb +0 -33
  600. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_variable_warning.rb +0 -52
  601. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/functions.rb +0 -2693
  602. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/lexer.rb +0 -464
  603. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/parser.rb +0 -832
  604. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree.rb +0 -16
  605. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/funcall.rb +0 -313
  606. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/interpolation.rb +0 -223
  607. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/list_literal.rb +0 -104
  608. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/literal.rb +0 -49
  609. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/map_literal.rb +0 -64
  610. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/node.rb +0 -127
  611. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/operation.rb +0 -156
  612. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/selector.rb +0 -26
  613. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/string_interpolation.rb +0 -125
  614. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/unary_operation.rb +0 -69
  615. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/variable.rb +0 -57
  616. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value.rb +0 -11
  617. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/arg_list.rb +0 -36
  618. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/base.rb +0 -241
  619. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/bool.rb +0 -35
  620. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/color.rb +0 -698
  621. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/helpers.rb +0 -272
  622. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/list.rb +0 -113
  623. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/map.rb +0 -70
  624. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/null.rb +0 -44
  625. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/number.rb +0 -563
  626. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/string.rb +0 -138
  627. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss.rb +0 -14
  628. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/css_parser.rb +0 -56
  629. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/parser.rb +0 -1254
  630. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/rx.rb +0 -140
  631. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/static_parser.rb +0 -373
  632. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector.rb +0 -323
  633. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/abstract_sequence.rb +0 -111
  634. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/comma_sequence.rb +0 -191
  635. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/pseudo.rb +0 -266
  636. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/sequence.rb +0 -636
  637. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple.rb +0 -117
  638. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple_sequence.rb +0 -344
  639. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/shared.rb +0 -76
  640. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/map.rb +0 -213
  641. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/position.rb +0 -39
  642. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/range.rb +0 -41
  643. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/stack.rb +0 -120
  644. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/supports.rb +0 -225
  645. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/at_root_node.rb +0 -83
  646. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/charset_node.rb +0 -22
  647. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/comment_node.rb +0 -82
  648. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/content_node.rb +0 -9
  649. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/css_import_node.rb +0 -68
  650. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/debug_node.rb +0 -18
  651. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/directive_node.rb +0 -59
  652. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/each_node.rb +0 -24
  653. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/error_node.rb +0 -18
  654. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/extend_node.rb +0 -43
  655. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/for_node.rb +0 -36
  656. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/function_node.rb +0 -44
  657. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/if_node.rb +0 -52
  658. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/import_node.rb +0 -75
  659. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/keyframe_rule_node.rb +0 -15
  660. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/media_node.rb +0 -48
  661. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_def_node.rb +0 -38
  662. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_node.rb +0 -52
  663. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/node.rb +0 -240
  664. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/prop_node.rb +0 -170
  665. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/return_node.rb +0 -19
  666. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/root_node.rb +0 -44
  667. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/rule_node.rb +0 -155
  668. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/supports_node.rb +0 -38
  669. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/trace_node.rb +0 -33
  670. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/variable_node.rb +0 -36
  671. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/base.rb +0 -72
  672. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/check_nesting.rb +0 -173
  673. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/convert.rb +0 -351
  674. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/cssize.rb +0 -373
  675. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/deep_copy.rb +0 -107
  676. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/extend.rb +0 -70
  677. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/perform.rb +0 -564
  678. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/set_options.rb +0 -139
  679. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/to_css.rb +0 -409
  680. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/warn_node.rb +0 -18
  681. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/while_node.rb +0 -18
  682. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util.rb +0 -1375
  683. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/cross_platform_random.rb +0 -19
  684. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/multibyte_string_scanner.rb +0 -155
  685. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/normalized_map.rb +0 -129
  686. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/ordered_hash.rb +0 -192
  687. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/subset_map.rb +0 -109
  688. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/test.rb +0 -9
  689. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/version.rb +0 -124
  690. data/bundle/ruby/2.5.0/gems/sass-3.4.25/rails/init.rb +0 -1
  691. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CHANGELOG.md +0 -1
  692. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CONTRIBUTING.md +0 -38
  693. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Gemfile +0 -20
  694. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Guardfile +0 -8
  695. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/README.md +0 -349
  696. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Rakefile +0 -5
  697. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Vagrantfile +0 -96
  698. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen.rb +0 -54
  699. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapter.rb +0 -327
  700. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  701. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  702. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  703. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  704. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  705. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/directory_record.rb +0 -406
  706. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/listener.rb +0 -323
  707. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/turnstile.rb +0 -32
  708. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/version.rb +0 -3
  709. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/listen.gemspec +0 -28
  710. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  711. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  712. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  713. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  714. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  715. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  716. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  717. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/listener_spec.rb +0 -258
  718. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  719. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen_spec.rb +0 -67
  720. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/spec_helper.rb +0 -25
  721. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/adapter_helper.rb +0 -666
  722. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  723. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  724. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/listeners_helper.rb +0 -179
  725. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/platform_helper.rb +0 -15
  726. data/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/version.rb +0 -3
  727. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/CHANGELOG.md +0 -132
  728. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/Gemfile +0 -70
  729. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/HACKING +0 -16
  730. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/README.md +0 -233
  731. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/tilt.gemspec +0 -130
  732. data/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.1/data/display_width.marshal.gz +0 -0
@@ -1,10 +0,0 @@
1
- # Rails 3.0.0.beta.2+, < 3.1
2
- if defined?(ActiveSupport) && Sass::Util.has?(:public_method, ActiveSupport, :on_load) &&
3
- !Sass::Util.ap_geq?('3.1.0.beta')
4
- require 'sass/plugin/configuration'
5
- ActiveSupport.on_load(:before_configuration) do
6
- require 'sass'
7
- require 'sass/plugin'
8
- require 'sass/plugin/rails'
9
- end
10
- end
@@ -1,57 +0,0 @@
1
- require 'readline'
2
-
3
- module Sass
4
- # Runs a SassScript read-eval-print loop.
5
- # It presents a prompt on the terminal,
6
- # reads in SassScript expressions,
7
- # evaluates them,
8
- # and prints the result.
9
- class Repl
10
- # @param options [{Symbol => Object}] An options hash.
11
- def initialize(options = {})
12
- @options = options
13
- end
14
-
15
- # Starts the read-eval-print loop.
16
- def run
17
- environment = Environment.new
18
- @line = 0
19
- loop do
20
- @line += 1
21
- unless (text = Readline.readline('>> '))
22
- puts
23
- return
24
- end
25
-
26
- Readline::HISTORY << text
27
- parse_input(environment, text)
28
- end
29
- end
30
-
31
- private
32
-
33
- def parse_input(environment, text)
34
- case text
35
- when Script::MATCH
36
- name = $1
37
- guarded = !!$3
38
- val = Script::Parser.parse($2, @line, text.size - ($3 || '').size - $2.size)
39
-
40
- unless guarded && environment.var(name)
41
- environment.set_var(name, val.perform(environment))
42
- end
43
-
44
- p environment.var(name)
45
- else
46
- p Script::Parser.parse(text, @line, 0).perform(environment)
47
- end
48
- rescue Sass::SyntaxError => e
49
- puts "SyntaxError: #{e.message}"
50
- if @options[:trace]
51
- e.backtrace.each do |line|
52
- puts "\tfrom #{line}"
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,7 +0,0 @@
1
- module Sass
2
- # The root directory of the Sass source tree.
3
- # This may be overridden by the package manager
4
- # if the lib directory is separated from the main source tree.
5
- # @api public
6
- ROOT_DIR = File.expand_path(File.join(__FILE__, "../../.."))
7
- end
@@ -1,66 +0,0 @@
1
- require 'sass/scss/rx'
2
-
3
- module Sass
4
- # SassScript is code that's embedded in Sass documents
5
- # to allow for property values to be computed from variables.
6
- #
7
- # This module contains code that handles the parsing and evaluation of SassScript.
8
- module Script
9
- # The regular expression used to parse variables.
10
- MATCH = /^\$(#{Sass::SCSS::RX::IDENT})\s*:\s*(.+?)
11
- (!#{Sass::SCSS::RX::IDENT}(?:\s+!#{Sass::SCSS::RX::IDENT})*)?$/x
12
-
13
- # The regular expression used to validate variables without matching.
14
- VALIDATE = /^\$#{Sass::SCSS::RX::IDENT}$/
15
-
16
- # Parses a string of SassScript
17
- #
18
- # @param value [String] The SassScript
19
- # @param line [Integer] The number of the line on which the SassScript appeared.
20
- # Used for error reporting
21
- # @param offset [Integer] The number of characters in on `line` that the SassScript started.
22
- # Used for error reporting
23
- # @param options [{Symbol => Object}] An options hash;
24
- # see {file:SASS_REFERENCE.md#Options the Sass options documentation}
25
- # @return [Script::Tree::Node] The root node of the parse tree
26
- def self.parse(value, line, offset, options = {})
27
- Parser.parse(value, line, offset, options)
28
- rescue Sass::SyntaxError => e
29
- e.message << ": #{value.inspect}." if e.message == "SassScript error"
30
- e.modify_backtrace(:line => line, :filename => options[:filename])
31
- raise e
32
- end
33
-
34
- require 'sass/script/functions'
35
- require 'sass/script/parser'
36
- require 'sass/script/tree'
37
- require 'sass/script/value'
38
-
39
- # @private
40
- CONST_RENAMES = {
41
- :Literal => Sass::Script::Value::Base,
42
- :ArgList => Sass::Script::Value::ArgList,
43
- :Bool => Sass::Script::Value::Bool,
44
- :Color => Sass::Script::Value::Color,
45
- :List => Sass::Script::Value::List,
46
- :Null => Sass::Script::Value::Null,
47
- :Number => Sass::Script::Value::Number,
48
- :String => Sass::Script::Value::String,
49
- :Node => Sass::Script::Tree::Node,
50
- :Funcall => Sass::Script::Tree::Funcall,
51
- :Interpolation => Sass::Script::Tree::Interpolation,
52
- :Operation => Sass::Script::Tree::Operation,
53
- :StringInterpolation => Sass::Script::Tree::StringInterpolation,
54
- :UnaryOperation => Sass::Script::Tree::UnaryOperation,
55
- :Variable => Sass::Script::Tree::Variable,
56
- }
57
-
58
- # @private
59
- def self.const_missing(name)
60
- klass = CONST_RENAMES[name]
61
- super unless klass
62
- CONST_RENAMES.each {|n, k| const_set(n, k)}
63
- klass
64
- end
65
- end
66
- end
@@ -1,33 +0,0 @@
1
- module Sass
2
- module Script
3
- # This is a subclass of {Lexer} for use in parsing plain CSS properties.
4
- #
5
- # @see Sass::SCSS::CssParser
6
- class CssLexer < Lexer
7
- private
8
-
9
- def token
10
- important || super
11
- end
12
-
13
- def string(re, *args)
14
- if re == :uri
15
- uri = scan(URI)
16
- return unless uri
17
- return [:string, Script::Value::String.new(uri)]
18
- end
19
-
20
- return unless scan(STRING)
21
- string_value = Sass::Script::Value::String.value(@scanner[1] || @scanner[2])
22
- value = Script::Value::String.new(string_value, :string)
23
- [:string, value]
24
- end
25
-
26
- def important
27
- s = scan(IMPORTANT)
28
- return unless s
29
- [:raw, s]
30
- end
31
- end
32
- end
33
- end
@@ -1,33 +0,0 @@
1
- require 'sass/script'
2
- require 'sass/script/css_lexer'
3
-
4
- module Sass
5
- module Script
6
- # This is a subclass of {Parser} for use in parsing plain CSS properties.
7
- #
8
- # @see Sass::SCSS::CssParser
9
- class CssParser < Parser
10
- private
11
-
12
- # @private
13
- def lexer_class; CssLexer; end
14
-
15
- # We need a production that only does /,
16
- # since * and % aren't allowed in plain CSS
17
- production :div, :unary_plus, :div
18
-
19
- def string
20
- tok = try_tok(:string)
21
- return number unless tok
22
- return if @lexer.peek && @lexer.peek.type == :begin_interpolation
23
- literal_node(tok.value, tok.source_range)
24
- end
25
-
26
- # Short-circuit all the SassScript-only productions
27
- alias_method :interpolation, :space
28
- alias_method :or_expr, :div
29
- alias_method :unary_div, :ident
30
- alias_method :paren, :string
31
- end
32
- end
33
- end
@@ -1,52 +0,0 @@
1
- module Sass
2
- module Script
3
- # An object tracking whether a warning has been emitted for a given script
4
- # tree.
5
- #
6
- # This is shared among all objects in a script tree. Whenever any of those
7
- # objects encounters a situation in which it wouldn't produce semantically
8
- # identical CSS to its input, it calls \{#warn!\}. The first time \{#warn!}
9
- # is called for a given warning object, it prints a deprecation warning.
10
- class CssVariableWarning
11
- def initialize
12
- @warned = false
13
- @value = nil
14
- end
15
-
16
- # Sets the root of the script tree that this warning refers to.
17
- #
18
- # @param value [Sass::Script::Tree::Node]
19
- def value=(value)
20
- warn_called = @warned && !@value
21
- @value = value
22
- print_warning if warn_called
23
- end
24
-
25
- # The first time this is called, it prints a deprecation warning.
26
- #
27
- # This may be called before \{#value=}. If it is, the warning is emitted
28
- # once the script tree is set.
29
- def warn!
30
- return if @warned
31
- @warned = true
32
- return unless @value
33
-
34
- print_warning
35
- end
36
-
37
- private
38
-
39
- # Prints this node's warning.
40
- def print_warning
41
- of_filename = " of #{@value.filename}" if @value.filename
42
- Sass::Util.sass_warn(
43
- "DEPRECATION WARNING on line #{@value.line}#{of_filename}:\n" +
44
- "Sass 3.6 will change the way CSS variables are parsed. Instead of being parsed as\n" +
45
- "normal properties, they will not allow any Sass-specific behavior other than \#{}.\n" +
46
- "For forwards-compatibility, use \#{}:\n" +
47
- "\n" +
48
- " --variable: \#{#{@value.to_sass}};")
49
- end
50
- end
51
- end
52
- end
@@ -1,2693 +0,0 @@
1
- require 'sass/script/value/helpers'
2
-
3
- module Sass::Script
4
- # @comment
5
- # YARD can't handle some multiline tags, and we need really long tags for function declarations.
6
- # rubocop:disable LineLength
7
- # Methods in this module are accessible from the SassScript context.
8
- # For example, you can write
9
- #
10
- # $color: hsl(120deg, 100%, 50%)
11
- #
12
- # and it will call {Functions#hsl}.
13
- #
14
- # The following functions are provided:
15
- #
16
- # *Note: These functions are described in more detail below.*
17
- #
18
- # ## RGB Functions
19
- #
20
- # \{#rgb rgb($red, $green, $blue)}
21
- # : Creates a {Sass::Script::Value::Color Color} from red, green, and blue
22
- # values.
23
- #
24
- # \{#rgba rgba($red, $green, $blue, $alpha)}
25
- # : Creates a {Sass::Script::Value::Color Color} from red, green, blue, and
26
- # alpha values.
27
- #
28
- # \{#red red($color)}
29
- # : Gets the red component of a color.
30
- #
31
- # \{#green green($color)}
32
- # : Gets the green component of a color.
33
- #
34
- # \{#blue blue($color)}
35
- # : Gets the blue component of a color.
36
- #
37
- # \{#mix mix($color1, $color2, \[$weight\])}
38
- # : Mixes two colors together.
39
- #
40
- # ## HSL Functions
41
- #
42
- # \{#hsl hsl($hue, $saturation, $lightness)}
43
- # : Creates a {Sass::Script::Value::Color Color} from hue, saturation, and
44
- # lightness values.
45
- #
46
- # \{#hsla hsla($hue, $saturation, $lightness, $alpha)}
47
- # : Creates a {Sass::Script::Value::Color Color} from hue, saturation,
48
- # lightness, and alpha values.
49
- #
50
- # \{#hue hue($color)}
51
- # : Gets the hue component of a color.
52
- #
53
- # \{#saturation saturation($color)}
54
- # : Gets the saturation component of a color.
55
- #
56
- # \{#lightness lightness($color)}
57
- # : Gets the lightness component of a color.
58
- #
59
- # \{#adjust_hue adjust-hue($color, $degrees)}
60
- # : Changes the hue of a color.
61
- #
62
- # \{#lighten lighten($color, $amount)}
63
- # : Makes a color lighter.
64
- #
65
- # \{#darken darken($color, $amount)}
66
- # : Makes a color darker.
67
- #
68
- # \{#saturate saturate($color, $amount)}
69
- # : Makes a color more saturated.
70
- #
71
- # \{#desaturate desaturate($color, $amount)}
72
- # : Makes a color less saturated.
73
- #
74
- # \{#grayscale grayscale($color)}
75
- # : Converts a color to grayscale.
76
- #
77
- # \{#complement complement($color)}
78
- # : Returns the complement of a color.
79
- #
80
- # \{#invert invert($color)}
81
- # : Returns the inverse of a color.
82
- #
83
- # ## Opacity Functions
84
- #
85
- # \{#alpha alpha($color)} / \{#opacity opacity($color)}
86
- # : Gets the alpha component (opacity) of a color.
87
- #
88
- # \{#rgba rgba($color, $alpha)}
89
- # : Changes the alpha component for a color.
90
- #
91
- # \{#opacify opacify($color, $amount)} / \{#fade_in fade-in($color, $amount)}
92
- # : Makes a color more opaque.
93
- #
94
- # \{#transparentize transparentize($color, $amount)} / \{#fade_out fade-out($color, $amount)}
95
- # : Makes a color more transparent.
96
- #
97
- # ## Other Color Functions
98
- #
99
- # \{#adjust_color adjust-color($color, \[$red\], \[$green\], \[$blue\], \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\])}
100
- # : Increases or decreases one or more components of a color.
101
- #
102
- # \{#scale_color scale-color($color, \[$red\], \[$green\], \[$blue\], \[$saturation\], \[$lightness\], \[$alpha\])}
103
- # : Fluidly scales one or more properties of a color.
104
- #
105
- # \{#change_color change-color($color, \[$red\], \[$green\], \[$blue\], \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\])}
106
- # : Changes one or more properties of a color.
107
- #
108
- # \{#ie_hex_str ie-hex-str($color)}
109
- # : Converts a color into the format understood by IE filters.
110
- #
111
- # ## String Functions
112
- #
113
- # \{#unquote unquote($string)}
114
- # : Removes quotes from a string.
115
- #
116
- # \{#quote quote($string)}
117
- # : Adds quotes to a string.
118
- #
119
- # \{#str_length str-length($string)}
120
- # : Returns the number of characters in a string.
121
- #
122
- # \{#str_insert str-insert($string, $insert, $index)}
123
- # : Inserts `$insert` into `$string` at `$index`.
124
- #
125
- # \{#str_index str-index($string, $substring)}
126
- # : Returns the index of the first occurrence of `$substring` in `$string`.
127
- #
128
- # \{#str_slice str-slice($string, $start-at, [$end-at])}
129
- # : Extracts a substring from `$string`.
130
- #
131
- # \{#to_upper_case to-upper-case($string)}
132
- # : Converts a string to upper case.
133
- #
134
- # \{#to_lower_case to-lower-case($string)}
135
- # : Converts a string to lower case.
136
- #
137
- # ## Number Functions
138
- #
139
- # \{#percentage percentage($number)}
140
- # : Converts a unitless number to a percentage.
141
- #
142
- # \{#round round($number)}
143
- # : Rounds a number to the nearest whole number.
144
- #
145
- # \{#ceil ceil($number)}
146
- # : Rounds a number up to the next whole number.
147
- #
148
- # \{#floor floor($number)}
149
- # : Rounds a number down to the previous whole number.
150
- #
151
- # \{#abs abs($number)}
152
- # : Returns the absolute value of a number.
153
- #
154
- # \{#min min($numbers...)\}
155
- # : Finds the minimum of several numbers.
156
- #
157
- # \{#max max($numbers...)\}
158
- # : Finds the maximum of several numbers.
159
- #
160
- # \{#random random([$limit])\}
161
- # : Returns a random number.
162
- #
163
- # ## List Functions {#list-functions}
164
- #
165
- # Lists in Sass are immutable; all list functions return a new list rather
166
- # than updating the existing list in-place.
167
- #
168
- # All list functions work for maps as well, treating them as lists of pairs.
169
- #
170
- # \{#length length($list)}
171
- # : Returns the length of a list.
172
- #
173
- # \{#nth nth($list, $n)}
174
- # : Returns a specific item in a list.
175
- #
176
- # \{#set-nth set-nth($list, $n, $value)}
177
- # : Replaces the nth item in a list.
178
- #
179
- # \{#join join($list1, $list2, \[$separator\])}
180
- # : Joins together two lists into one.
181
- #
182
- # \{#append append($list1, $val, \[$separator\])}
183
- # : Appends a single value onto the end of a list.
184
- #
185
- # \{#zip zip($lists...)}
186
- # : Combines several lists into a single multidimensional list.
187
- #
188
- # \{#index index($list, $value)}
189
- # : Returns the position of a value within a list.
190
- #
191
- # \{#list_separator list-separator($list)}
192
- # : Returns the separator of a list.
193
- #
194
- # ## Map Functions {#map-functions}
195
- #
196
- # Maps in Sass are immutable; all map functions return a new map rather than
197
- # updating the existing map in-place.
198
- #
199
- # \{#map_get map-get($map, $key)}
200
- # : Returns the value in a map associated with a given key.
201
- #
202
- # \{#map_merge map-merge($map1, $map2)}
203
- # : Merges two maps together into a new map.
204
- #
205
- # \{#map_remove map-remove($map, $keys...)}
206
- # : Returns a new map with keys removed.
207
- #
208
- # \{#map_keys map-keys($map)}
209
- # : Returns a list of all keys in a map.
210
- #
211
- # \{#map_values map-values($map)}
212
- # : Returns a list of all values in a map.
213
- #
214
- # \{#map_has_key map-has-key($map, $key)}
215
- # : Returns whether a map has a value associated with a given key.
216
- #
217
- # \{#keywords keywords($args)}
218
- # : Returns the keywords passed to a function that takes variable arguments.
219
- #
220
- # ## Selector Functions
221
- #
222
- # Selector functions are very liberal in the formats they support
223
- # for selector arguments. They can take a plain string, a list of
224
- # lists as returned by `&` or anything in between:
225
- #
226
- # * A plain string, such as `".foo .bar, .baz .bang"`.
227
- # * A space-separated list of strings such as `(".foo" ".bar")`.
228
- # * A comma-separated list of strings such as `(".foo .bar", ".baz .bang")`.
229
- # * A comma-separated list of space-separated lists of strings such
230
- # as `((".foo" ".bar"), (".baz" ".bang"))`.
231
- #
232
- # In general, selector functions allow placeholder selectors
233
- # (`%foo`) but disallow parent-reference selectors (`&`).
234
- #
235
- # \{#selector_nest selector-nest($selectors...)}
236
- # : Nests selector beneath one another like they would be nested in the
237
- # stylesheet.
238
- #
239
- # \{#selector_append selector-append($selectors...)}
240
- # : Appends selectors to one another without spaces in between.
241
- #
242
- # \{#selector_extend selector-extend($selector, $extendee, $extender)}
243
- # : Extends `$extendee` with `$extender` within `$selector`.
244
- #
245
- # \{#selector_replace selector-replace($selector, $original, $replacement)}
246
- # : Replaces `$original` with `$replacement` within `$selector`.
247
- #
248
- # \{#selector_unify selector-unify($selector1, $selector2)}
249
- # : Unifies two selectors to produce a selector that matches
250
- # elements matched by both.
251
- #
252
- # \{#is_superselector is-superselector($super, $sub)}
253
- # : Returns whether `$super` matches all the elements `$sub` does, and
254
- # possibly more.
255
- #
256
- # \{#simple_selectors simple-selectors($selector)}
257
- # : Returns the simple selectors that comprise a compound selector.
258
- #
259
- # \{#selector_parse selector-parse($selector)}
260
- # : Parses a selector into the format returned by `&`.
261
- #
262
- # ## Introspection Functions
263
- #
264
- # \{#feature_exists feature-exists($feature)}
265
- # : Returns whether a feature exists in the current Sass runtime.
266
- #
267
- # \{#variable_exists variable-exists($name)}
268
- # : Returns whether a variable with the given name exists in the current scope.
269
- #
270
- # \{#global_variable_exists global-variable-exists($name)}
271
- # : Returns whether a variable with the given name exists in the global scope.
272
- #
273
- # \{#function_exists function-exists($name)}
274
- # : Returns whether a function with the given name exists.
275
- #
276
- # \{#mixin_exists mixin-exists($name)}
277
- # : Returns whether a mixin with the given name exists.
278
- #
279
- # \{#inspect inspect($value)}
280
- # : Returns the string representation of a value as it would be represented in Sass.
281
- #
282
- # \{#type_of type-of($value)}
283
- # : Returns the type of a value.
284
- #
285
- # \{#unit unit($number)}
286
- # : Returns the unit(s) associated with a number.
287
- #
288
- # \{#unitless unitless($number)}
289
- # : Returns whether a number has units.
290
- #
291
- # \{#comparable comparable($number1, $number2)}
292
- # : Returns whether two numbers can be added, subtracted, or compared.
293
- #
294
- # \{#call call($name, $args...)}
295
- # : Dynamically calls a Sass function.
296
- #
297
- # ## Miscellaneous Functions
298
- #
299
- # \{#if if($condition, $if-true, $if-false)}
300
- # : Returns one of two values, depending on whether or not `$condition` is
301
- # true.
302
- #
303
- # \{#unique_id unique-id()}
304
- # : Returns a unique CSS identifier.
305
- #
306
- # ## Adding Custom Functions
307
- #
308
- # New Sass functions can be added by adding Ruby methods to this module.
309
- # For example:
310
- #
311
- # module Sass::Script::Functions
312
- # def reverse(string)
313
- # assert_type string, :String
314
- # Sass::Script::Value::String.new(string.value.reverse)
315
- # end
316
- # declare :reverse, [:string]
317
- # end
318
- #
319
- # Calling {declare} tells Sass the argument names for your function.
320
- # If omitted, the function will still work, but will not be able to accept keyword arguments.
321
- # {declare} can also allow your function to take arbitrary keyword arguments.
322
- #
323
- # There are a few things to keep in mind when modifying this module.
324
- # First of all, the arguments passed are {Value} objects.
325
- # Value objects are also expected to be returned.
326
- # This means that Ruby values must be unwrapped and wrapped.
327
- #
328
- # Most Value objects support the {Value::Base#value value} accessor for getting
329
- # their Ruby values. Color objects, though, must be accessed using
330
- # {Sass::Script::Value::Color#rgb rgb}, {Sass::Script::Value::Color#red red},
331
- # {Sass::Script::Value::Color#blue green}, or {Sass::Script::Value::Color#blue
332
- # blue}.
333
- #
334
- # Second, making Ruby functions accessible from Sass introduces the temptation
335
- # to do things like database access within stylesheets.
336
- # This is generally a bad idea;
337
- # since Sass files are by default only compiled once,
338
- # dynamic code is not a great fit.
339
- #
340
- # If you really, really need to compile Sass on each request,
341
- # first make sure you have adequate caching set up.
342
- # Then you can use {Sass::Engine} to render the code,
343
- # using the {file:SASS_REFERENCE.md#custom-option `options` parameter}
344
- # to pass in data that {EvaluationContext#options can be accessed}
345
- # from your Sass functions.
346
- #
347
- # Within one of the functions in this module,
348
- # methods of {EvaluationContext} can be used.
349
- #
350
- # ### Caveats
351
- #
352
- # When creating new {Value} objects within functions, be aware that it's not
353
- # safe to call {Value::Base#to_s #to_s} (or other methods that use the string
354
- # representation) on those objects without first setting {Tree::Node#options=
355
- # the #options attribute}.
356
- #
357
- # @comment
358
- # rubocop:enable LineLength
359
- # rubocop:disable ModuleLength
360
- module Functions
361
- @signatures = {}
362
-
363
- # A class representing a Sass function signature.
364
- #
365
- # @attr args [Array<String>] The names of the arguments to the function.
366
- # @attr delayed_args [Array<String>] The names of the arguments whose evaluation should be
367
- # delayed.
368
- # @attr var_args [Boolean] Whether the function takes a variable number of arguments.
369
- # @attr var_kwargs [Boolean] Whether the function takes an arbitrary set of keyword arguments.
370
- Signature = Struct.new(:args, :delayed_args, :var_args, :var_kwargs, :deprecated)
371
-
372
- # Declare a Sass signature for a Ruby-defined function.
373
- # This includes the names of the arguments,
374
- # whether the function takes a variable number of arguments,
375
- # and whether the function takes an arbitrary set of keyword arguments.
376
- #
377
- # It's not necessary to declare a signature for a function.
378
- # However, without a signature it won't support keyword arguments.
379
- #
380
- # A single function can have multiple signatures declared
381
- # as long as each one takes a different number of arguments.
382
- # It's also possible to declare multiple signatures
383
- # that all take the same number of arguments,
384
- # but none of them but the first will be used
385
- # unless the user uses keyword arguments.
386
- #
387
- # @example
388
- # declare :rgba, [:hex, :alpha]
389
- # declare :rgba, [:red, :green, :blue, :alpha]
390
- # declare :accepts_anything, [], :var_args => true, :var_kwargs => true
391
- # declare :some_func, [:foo, :bar, :baz], :var_kwargs => true
392
- #
393
- # @param method_name [Symbol] The name of the method
394
- # whose signature is being declared.
395
- # @param args [Array<Symbol>] The names of the arguments for the function signature.
396
- # @option options :var_args [Boolean] (false)
397
- # Whether the function accepts a variable number of (unnamed) arguments
398
- # in addition to the named arguments.
399
- # @option options :var_kwargs [Boolean] (false)
400
- # Whether the function accepts other keyword arguments
401
- # in addition to those in `:args`.
402
- # If this is true, the Ruby function will be passed a hash from strings
403
- # to {Value}s as the last argument.
404
- # In addition, if this is true and `:var_args` is not,
405
- # Sass will ensure that the last argument passed is a hash.
406
- def self.declare(method_name, args, options = {})
407
- delayed_args = []
408
- args = args.map do |a|
409
- a = a.to_s
410
- if a[0] == ?&
411
- a = a[1..-1]
412
- delayed_args << a
413
- end
414
- a
415
- end
416
- # We don't expose this functionality except to certain builtin methods.
417
- if delayed_args.any? && method_name != :if
418
- raise ArgumentError.new("Delayed arguments are not allowed for method #{method_name}")
419
- end
420
- @signatures[method_name] ||= []
421
- @signatures[method_name] << Signature.new(
422
- args,
423
- delayed_args,
424
- options[:var_args],
425
- options[:var_kwargs],
426
- options[:deprecated] && options[:deprecated].map {|a| a.to_s})
427
- end
428
-
429
- # Determine the correct signature for the number of arguments
430
- # passed in for a given function.
431
- # If no signatures match, the first signature is returned for error messaging.
432
- #
433
- # @param method_name [Symbol] The name of the Ruby function to be called.
434
- # @param arg_arity [Integer] The number of unnamed arguments the function was passed.
435
- # @param kwarg_arity [Integer] The number of keyword arguments the function was passed.
436
- #
437
- # @return [{Symbol => Object}, nil]
438
- # The signature options for the matching signature,
439
- # or nil if no signatures are declared for this function. See {declare}.
440
- def self.signature(method_name, arg_arity, kwarg_arity)
441
- return unless @signatures[method_name]
442
- @signatures[method_name].each do |signature|
443
- sig_arity = signature.args.size
444
- return signature if sig_arity == arg_arity + kwarg_arity
445
- next unless sig_arity < arg_arity + kwarg_arity
446
-
447
- # We have enough args.
448
- # Now we need to figure out which args are varargs
449
- # and if the signature allows them.
450
- t_arg_arity, t_kwarg_arity = arg_arity, kwarg_arity
451
- if sig_arity > t_arg_arity
452
- # we transfer some kwargs arity to args arity
453
- # if it does not have enough args -- assuming the names will work out.
454
- t_kwarg_arity -= (sig_arity - t_arg_arity)
455
- t_arg_arity = sig_arity
456
- end
457
-
458
- if (t_arg_arity == sig_arity || t_arg_arity > sig_arity && signature.var_args) &&
459
- (t_kwarg_arity == 0 || t_kwarg_arity > 0 && signature.var_kwargs)
460
- return signature
461
- end
462
- end
463
- @signatures[method_name].first
464
- end
465
-
466
- # Sets the random seed used by Sass's internal random number generator.
467
- #
468
- # This can be used to ensure consistent random number sequences which
469
- # allows for consistent results when testing, etc.
470
- #
471
- # @param seed [Integer]
472
- # @return [Integer] The same seed.
473
- def self.random_seed=(seed)
474
- @random_number_generator = Sass::Util::CrossPlatformRandom.new(seed)
475
- end
476
-
477
- # Get Sass's internal random number generator.
478
- #
479
- # @return [Random]
480
- def self.random_number_generator
481
- @random_number_generator ||= Sass::Util::CrossPlatformRandom.new
482
- end
483
-
484
- # The context in which methods in {Script::Functions} are evaluated.
485
- # That means that all instance methods of {EvaluationContext}
486
- # are available to use in functions.
487
- class EvaluationContext
488
- include Functions
489
- include Value::Helpers
490
-
491
- # The human-readable names for [Sass::Script::Value::Base]. The default is
492
- # just the downcased name of the type.
493
- TYPE_NAMES = {:ArgList => 'variable argument list'}
494
-
495
- # The environment for this function. This environment's
496
- # {Environment#parent} is the global environment, and its
497
- # {Environment#caller} is a read-only view of the local environment of the
498
- # caller of this function.
499
- #
500
- # @return [Environment]
501
- attr_reader :environment
502
-
503
- # The options hash for the {Sass::Engine} that is processing the function call
504
- #
505
- # @return [{Symbol => Object}]
506
- attr_reader :options
507
-
508
- # @param environment [Environment] See \{#environment}
509
- def initialize(environment)
510
- @environment = environment
511
- @options = environment.options
512
- end
513
-
514
- # Asserts that the type of a given SassScript value
515
- # is the expected type (designated by a symbol).
516
- #
517
- # Valid types are `:Bool`, `:Color`, `:Number`, and `:String`.
518
- # Note that `:String` will match both double-quoted strings
519
- # and unquoted identifiers.
520
- #
521
- # @example
522
- # assert_type value, :String
523
- # assert_type value, :Number
524
- # @param value [Sass::Script::Value::Base] A SassScript value
525
- # @param type [Symbol] The name of the type the value is expected to be
526
- # @param name [String, Symbol, nil] The name of the argument.
527
- # @raise [ArgumentError] if value is not of the correct type.
528
- def assert_type(value, type, name = nil)
529
- klass = Sass::Script::Value.const_get(type)
530
- if value.is_a?(klass)
531
- value.check_deprecated_interp if type == :String
532
- return
533
- end
534
-
535
- return if value.is_a?(Sass::Script::Value::List) && type == :Map && value.value.empty?
536
- err = "#{value.inspect} is not a #{TYPE_NAMES[type] || type.to_s.downcase}"
537
- err = "$#{name.to_s.tr('_', '-')}: " + err if name
538
- raise ArgumentError.new(err)
539
- end
540
-
541
- # Asserts that the unit of the number is as expected.
542
- #
543
- # @example
544
- # assert_unit number, "px"
545
- # assert_unit number, nil
546
- # @param number [Sass::Script::Value::Number] The number to be validated.
547
- # @param unit [::String]
548
- # The unit that the number must have.
549
- # If nil, the number must be unitless.
550
- # @param name [::String] The name of the parameter being validated.
551
- # @raise [ArgumentError] if number is not of the correct unit or is not a number.
552
- def assert_unit(number, unit, name = nil)
553
- assert_type number, :Number, name
554
- return if number.is_unit?(unit)
555
- expectation = unit ? "have a unit of #{unit}" : "be unitless"
556
- if name
557
- raise ArgumentError.new("Expected $#{name} to #{expectation} but got #{number}")
558
- else
559
- raise ArgumentError.new("Expected #{number} to #{expectation}")
560
- end
561
- end
562
-
563
- # Asserts that the value is an integer.
564
- #
565
- # @example
566
- # assert_integer 2px
567
- # assert_integer 2.5px
568
- # => SyntaxError: "Expected 2.5px to be an integer"
569
- # assert_integer 2.5px, "width"
570
- # => SyntaxError: "Expected width to be an integer but got 2.5px"
571
- # @param number [Sass::Script::Value::Base] The value to be validated.
572
- # @param name [::String] The name of the parameter being validated.
573
- # @raise [ArgumentError] if number is not an integer or is not a number.
574
- def assert_integer(number, name = nil)
575
- assert_type number, :Number, name
576
- return if number.int?
577
- if name
578
- raise ArgumentError.new("Expected $#{name} to be an integer but got #{number}")
579
- else
580
- raise ArgumentError.new("Expected #{number} to be an integer")
581
- end
582
- end
583
-
584
- # Performs a node that has been delayed for execution.
585
- #
586
- # @private
587
- # @param node [Sass::Script::Tree::Node,
588
- # Sass::Script::Value::Base] When this is a tree node, it's
589
- # performed in the caller's environment. When it's a value
590
- # (which can happen when the value had to be performed already
591
- # -- like for a splat), it's returned as-is.
592
- # @param env [Sass::Environment] The environment within which to perform the node.
593
- # Defaults to the (read-only) environment of the caller.
594
- def perform(node, env = environment.caller)
595
- if node.is_a?(Sass::Script::Value::Base)
596
- node
597
- else
598
- node.perform(env)
599
- end
600
- end
601
- end
602
-
603
- class << self
604
- # Returns whether user function with a given name exists.
605
- #
606
- # @param function_name [String]
607
- # @return [Boolean]
608
- alias_method :callable?, :public_method_defined?
609
-
610
- private
611
-
612
- def include(*args)
613
- r = super
614
- # We have to re-include ourselves into EvaluationContext to work around
615
- # an icky Ruby restriction.
616
- EvaluationContext.send :include, self
617
- r
618
- end
619
- end
620
-
621
- # Creates a {Sass::Script::Value::Color Color} object from red, green, and
622
- # blue values.
623
- #
624
- # @see #rgba
625
- # @overload rgb($red, $green, $blue)
626
- # @param $red [Sass::Script::Value::Number] The amount of red in the color.
627
- # Must be between 0 and 255 inclusive, or between `0%` and `100%`
628
- # inclusive
629
- # @param $green [Sass::Script::Value::Number] The amount of green in the
630
- # color. Must be between 0 and 255 inclusive, or between `0%` and `100%`
631
- # inclusive
632
- # @param $blue [Sass::Script::Value::Number] The amount of blue in the
633
- # color. Must be between 0 and 255 inclusive, or between `0%` and `100%`
634
- # inclusive
635
- # @return [Sass::Script::Value::Color]
636
- # @raise [ArgumentError] if any parameter is the wrong type or out of bounds
637
- def rgb(red, green, blue)
638
- if calc?(red) || calc?(green) || calc?(blue)
639
- return unquoted_string("rgb(#{red}, #{green}, #{blue})")
640
- end
641
- assert_type red, :Number, :red
642
- assert_type green, :Number, :green
643
- assert_type blue, :Number, :blue
644
-
645
- color_attrs = [red, green, blue].map do |c|
646
- if c.is_unit?("%")
647
- c.value * 255 / 100.0
648
- elsif c.unitless?
649
- c.value
650
- else
651
- raise ArgumentError.new("Expected #{c} to be unitless or have a unit of % but got #{c}")
652
- end
653
- end
654
-
655
- # Don't store the string representation for function-created colors, both
656
- # because it's not very useful and because some functions aren't supported
657
- # on older browsers.
658
- Sass::Script::Value::Color.new(color_attrs)
659
- end
660
- declare :rgb, [:red, :green, :blue]
661
-
662
- # Creates a {Sass::Script::Value::Color Color} from red, green, blue, and
663
- # alpha values.
664
- # @see #rgb
665
- #
666
- # @overload rgba($red, $green, $blue, $alpha)
667
- # @param $red [Sass::Script::Value::Number] The amount of red in the
668
- # color. Must be between 0 and 255 inclusive or 0% and 100% inclusive
669
- # @param $green [Sass::Script::Value::Number] The amount of green in the
670
- # color. Must be between 0 and 255 inclusive or 0% and 100% inclusive
671
- # @param $blue [Sass::Script::Value::Number] The amount of blue in the
672
- # color. Must be between 0 and 255 inclusive or 0% and 100% inclusive
673
- # @param $alpha [Sass::Script::Value::Number] The opacity of the color.
674
- # Must be between 0 and 1 inclusive
675
- # @return [Sass::Script::Value::Color]
676
- # @raise [ArgumentError] if any parameter is the wrong type or out of
677
- # bounds
678
- #
679
- # @overload rgba($color, $alpha)
680
- # Sets the opacity of an existing color.
681
- #
682
- # @example
683
- # rgba(#102030, 0.5) => rgba(16, 32, 48, 0.5)
684
- # rgba(blue, 0.2) => rgba(0, 0, 255, 0.2)
685
- #
686
- # @param $color [Sass::Script::Value::Color] The color whose opacity will
687
- # be changed.
688
- # @param $alpha [Sass::Script::Value::Number] The new opacity of the
689
- # color. Must be between 0 and 1 inclusive
690
- # @return [Sass::Script::Value::Color]
691
- # @raise [ArgumentError] if `$alpha` is out of bounds or either parameter
692
- # is the wrong type
693
- def rgba(*args)
694
- case args.size
695
- when 2
696
- color, alpha = args
697
-
698
- assert_type color, :Color, :color
699
- if calc?(alpha)
700
- unquoted_string("rgba(#{color.red}, #{color.green}, #{color.blue}, #{alpha})")
701
- else
702
- assert_type alpha, :Number, :alpha
703
- check_alpha_unit alpha, 'rgba'
704
- color.with(:alpha => alpha.value)
705
- end
706
- when 4
707
- red, green, blue, alpha = args
708
- if calc?(red) || calc?(green) || calc?(blue) || calc?(alpha)
709
- unquoted_string("rgba(#{red}, #{green}, #{blue}, #{alpha})")
710
- else
711
- rgba(rgb(red, green, blue), alpha)
712
- end
713
- else
714
- raise ArgumentError.new("wrong number of arguments (#{args.size} for 4)")
715
- end
716
- end
717
- declare :rgba, [:red, :green, :blue, :alpha]
718
- declare :rgba, [:color, :alpha]
719
-
720
- # Creates a {Sass::Script::Value::Color Color} from hue, saturation, and
721
- # lightness values. Uses the algorithm from the [CSS3 spec][].
722
- #
723
- # [CSS3 spec]: http://www.w3.org/TR/css3-color/#hsl-color
724
- #
725
- # @see #hsla
726
- # @overload hsl($hue, $saturation, $lightness)
727
- # @param $hue [Sass::Script::Value::Number] The hue of the color. Should be
728
- # between 0 and 360 degrees, inclusive
729
- # @param $saturation [Sass::Script::Value::Number] The saturation of the
730
- # color. Must be between `0%` and `100%`, inclusive
731
- # @param $lightness [Sass::Script::Value::Number] The lightness of the
732
- # color. Must be between `0%` and `100%`, inclusive
733
- # @return [Sass::Script::Value::Color]
734
- # @raise [ArgumentError] if `$saturation` or `$lightness` are out of bounds
735
- # or any parameter is the wrong type
736
- def hsl(hue, saturation, lightness)
737
- if calc?(hue) || calc?(saturation) || calc?(lightness)
738
- unquoted_string("hsl(#{hue}, #{saturation}, #{lightness})")
739
- else
740
- hsla(hue, saturation, lightness, number(1))
741
- end
742
- end
743
- declare :hsl, [:hue, :saturation, :lightness]
744
-
745
- # Creates a {Sass::Script::Value::Color Color} from hue,
746
- # saturation, lightness, and alpha values. Uses the algorithm from
747
- # the [CSS3 spec][].
748
- #
749
- # [CSS3 spec]: http://www.w3.org/TR/css3-color/#hsl-color
750
- #
751
- # @see #hsl
752
- # @overload hsla($hue, $saturation, $lightness, $alpha)
753
- # @param $hue [Sass::Script::Value::Number] The hue of the color. Should be
754
- # between 0 and 360 degrees, inclusive
755
- # @param $saturation [Sass::Script::Value::Number] The saturation of the
756
- # color. Must be between `0%` and `100%`, inclusive
757
- # @param $lightness [Sass::Script::Value::Number] The lightness of the
758
- # color. Must be between `0%` and `100%`, inclusive
759
- # @param $alpha [Sass::Script::Value::Number] The opacity of the color. Must
760
- # be between 0 and 1, inclusive
761
- # @return [Sass::Script::Value::Color]
762
- # @raise [ArgumentError] if `$saturation`, `$lightness`, or `$alpha` are out
763
- # of bounds or any parameter is the wrong type
764
- def hsla(hue, saturation, lightness, alpha)
765
- if calc?(hue) || calc?(saturation) || calc?(lightness) || calc?(alpha)
766
- return unquoted_string("hsla(#{hue}, #{saturation}, #{lightness}, #{alpha})")
767
- end
768
- assert_type hue, :Number, :hue
769
- assert_type saturation, :Number, :saturation
770
- assert_type lightness, :Number, :lightness
771
- assert_type alpha, :Number, :alpha
772
- check_alpha_unit alpha, 'hsla'
773
-
774
- h = hue.value
775
- s = saturation.value
776
- l = lightness.value
777
-
778
- # Don't store the string representation for function-created colors, both
779
- # because it's not very useful and because some functions aren't supported
780
- # on older browsers.
781
- Sass::Script::Value::Color.new(
782
- :hue => h, :saturation => s, :lightness => l, :alpha => alpha.value)
783
- end
784
- declare :hsla, [:hue, :saturation, :lightness, :alpha]
785
-
786
- # Gets the red component of a color. Calculated from HSL where necessary via
787
- # [this algorithm][hsl-to-rgb].
788
- #
789
- # [hsl-to-rgb]: http://www.w3.org/TR/css3-color/#hsl-color
790
- #
791
- # @overload red($color)
792
- # @param $color [Sass::Script::Value::Color]
793
- # @return [Sass::Script::Value::Number] The red component, between 0 and 255
794
- # inclusive
795
- # @raise [ArgumentError] if `$color` isn't a color
796
- def red(color)
797
- assert_type color, :Color, :color
798
- number(color.red)
799
- end
800
- declare :red, [:color]
801
-
802
- # Gets the green component of a color. Calculated from HSL where necessary
803
- # via [this algorithm][hsl-to-rgb].
804
- #
805
- # [hsl-to-rgb]: http://www.w3.org/TR/css3-color/#hsl-color
806
- #
807
- # @overload green($color)
808
- # @param $color [Sass::Script::Value::Color]
809
- # @return [Sass::Script::Value::Number] The green component, between 0 and
810
- # 255 inclusive
811
- # @raise [ArgumentError] if `$color` isn't a color
812
- def green(color)
813
- assert_type color, :Color, :color
814
- number(color.green)
815
- end
816
- declare :green, [:color]
817
-
818
- # Gets the blue component of a color. Calculated from HSL where necessary
819
- # via [this algorithm][hsl-to-rgb].
820
- #
821
- # [hsl-to-rgb]: http://www.w3.org/TR/css3-color/#hsl-color
822
- #
823
- # @overload blue($color)
824
- # @param $color [Sass::Script::Value::Color]
825
- # @return [Sass::Script::Value::Number] The blue component, between 0 and
826
- # 255 inclusive
827
- # @raise [ArgumentError] if `$color` isn't a color
828
- def blue(color)
829
- assert_type color, :Color, :color
830
- number(color.blue)
831
- end
832
- declare :blue, [:color]
833
-
834
- # Returns the hue component of a color. See [the CSS3 HSL
835
- # specification][hsl]. Calculated from RGB where necessary via [this
836
- # algorithm][rgb-to-hsl].
837
- #
838
- # [hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
839
- # [rgb-to-hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
840
- #
841
- # @overload hue($color)
842
- # @param $color [Sass::Script::Value::Color]
843
- # @return [Sass::Script::Value::Number] The hue component, between 0deg and
844
- # 360deg
845
- # @raise [ArgumentError] if `$color` isn't a color
846
- def hue(color)
847
- assert_type color, :Color, :color
848
- number(color.hue, "deg")
849
- end
850
- declare :hue, [:color]
851
-
852
- # Returns the saturation component of a color. See [the CSS3 HSL
853
- # specification][hsl]. Calculated from RGB where necessary via [this
854
- # algorithm][rgb-to-hsl].
855
- #
856
- # [hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
857
- # [rgb-to-hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
858
- #
859
- # @overload saturation($color)
860
- # @param $color [Sass::Script::Value::Color]
861
- # @return [Sass::Script::Value::Number] The saturation component, between 0%
862
- # and 100%
863
- # @raise [ArgumentError] if `$color` isn't a color
864
- def saturation(color)
865
- assert_type color, :Color, :color
866
- number(color.saturation, "%")
867
- end
868
- declare :saturation, [:color]
869
-
870
- # Returns the lightness component of a color. See [the CSS3 HSL
871
- # specification][hsl]. Calculated from RGB where necessary via [this
872
- # algorithm][rgb-to-hsl].
873
- #
874
- # [hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
875
- # [rgb-to-hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
876
- #
877
- # @overload lightness($color)
878
- # @param $color [Sass::Script::Value::Color]
879
- # @return [Sass::Script::Value::Number] The lightness component, between 0%
880
- # and 100%
881
- # @raise [ArgumentError] if `$color` isn't a color
882
- def lightness(color)
883
- assert_type color, :Color, :color
884
- number(color.lightness, "%")
885
- end
886
- declare :lightness, [:color]
887
-
888
- # Returns the alpha component (opacity) of a color. This is 1 unless
889
- # otherwise specified.
890
- #
891
- # This function also supports the proprietary Microsoft `alpha(opacity=20)`
892
- # syntax as a special case.
893
- #
894
- # @overload alpha($color)
895
- # @param $color [Sass::Script::Value::Color]
896
- # @return [Sass::Script::Value::Number] The alpha component, between 0 and 1
897
- # @raise [ArgumentError] if `$color` isn't a color
898
- def alpha(*args)
899
- if args.all? do |a|
900
- a.is_a?(Sass::Script::Value::String) && a.type == :identifier &&
901
- a.value =~ /^[a-zA-Z]+\s*=/
902
- end
903
- # Support the proprietary MS alpha() function
904
- return identifier("alpha(#{args.map {|a| a.to_s}.join(', ')})")
905
- end
906
-
907
- raise ArgumentError.new("wrong number of arguments (#{args.size} for 1)") if args.size != 1
908
-
909
- assert_type args.first, :Color, :color
910
- number(args.first.alpha)
911
- end
912
- declare :alpha, [:color]
913
-
914
- # Returns the alpha component (opacity) of a color. This is 1 unless
915
- # otherwise specified.
916
- #
917
- # @overload opacity($color)
918
- # @param $color [Sass::Script::Value::Color]
919
- # @return [Sass::Script::Value::Number] The alpha component, between 0 and 1
920
- # @raise [ArgumentError] if `$color` isn't a color
921
- def opacity(color)
922
- if color.is_a?(Sass::Script::Value::Number)
923
- return identifier("opacity(#{color})")
924
- end
925
- assert_type color, :Color, :color
926
- number(color.alpha)
927
- end
928
- declare :opacity, [:color]
929
-
930
- # Makes a color more opaque. Takes a color and a number between 0 and 1, and
931
- # returns a color with the opacity increased by that amount.
932
- #
933
- # @see #transparentize
934
- # @example
935
- # opacify(rgba(0, 0, 0, 0.5), 0.1) => rgba(0, 0, 0, 0.6)
936
- # opacify(rgba(0, 0, 17, 0.8), 0.2) => #001
937
- # @overload opacify($color, $amount)
938
- # @param $color [Sass::Script::Value::Color]
939
- # @param $amount [Sass::Script::Value::Number] The amount to increase the
940
- # opacity by, between 0 and 1
941
- # @return [Sass::Script::Value::Color]
942
- # @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
943
- # is the wrong type
944
- def opacify(color, amount)
945
- _adjust(color, amount, :alpha, 0..1, :+)
946
- end
947
- declare :opacify, [:color, :amount]
948
-
949
- alias_method :fade_in, :opacify
950
- declare :fade_in, [:color, :amount]
951
-
952
- # Makes a color more transparent. Takes a color and a number between 0 and
953
- # 1, and returns a color with the opacity decreased by that amount.
954
- #
955
- # @see #opacify
956
- # @example
957
- # transparentize(rgba(0, 0, 0, 0.5), 0.1) => rgba(0, 0, 0, 0.4)
958
- # transparentize(rgba(0, 0, 0, 0.8), 0.2) => rgba(0, 0, 0, 0.6)
959
- # @overload transparentize($color, $amount)
960
- # @param $color [Sass::Script::Value::Color]
961
- # @param $amount [Sass::Script::Value::Number] The amount to decrease the
962
- # opacity by, between 0 and 1
963
- # @return [Sass::Script::Value::Color]
964
- # @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
965
- # is the wrong type
966
- def transparentize(color, amount)
967
- _adjust(color, amount, :alpha, 0..1, :-)
968
- end
969
- declare :transparentize, [:color, :amount]
970
-
971
- alias_method :fade_out, :transparentize
972
- declare :fade_out, [:color, :amount]
973
-
974
- # Makes a color lighter. Takes a color and a number between `0%` and `100%`,
975
- # and returns a color with the lightness increased by that amount.
976
- #
977
- # @see #darken
978
- # @example
979
- # lighten(hsl(0, 0%, 0%), 30%) => hsl(0, 0, 30)
980
- # lighten(#800, 20%) => #e00
981
- # @overload lighten($color, $amount)
982
- # @param $color [Sass::Script::Value::Color]
983
- # @param $amount [Sass::Script::Value::Number] The amount to increase the
984
- # lightness by, between `0%` and `100%`
985
- # @return [Sass::Script::Value::Color]
986
- # @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
987
- # is the wrong type
988
- def lighten(color, amount)
989
- _adjust(color, amount, :lightness, 0..100, :+, "%")
990
- end
991
- declare :lighten, [:color, :amount]
992
-
993
- # Makes a color darker. Takes a color and a number between 0% and 100%, and
994
- # returns a color with the lightness decreased by that amount.
995
- #
996
- # @see #lighten
997
- # @example
998
- # darken(hsl(25, 100%, 80%), 30%) => hsl(25, 100%, 50%)
999
- # darken(#800, 20%) => #200
1000
- # @overload darken($color, $amount)
1001
- # @param $color [Sass::Script::Value::Color]
1002
- # @param $amount [Sass::Script::Value::Number] The amount to decrease the
1003
- # lightness by, between `0%` and `100%`
1004
- # @return [Sass::Script::Value::Color]
1005
- # @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
1006
- # is the wrong type
1007
- def darken(color, amount)
1008
- _adjust(color, amount, :lightness, 0..100, :-, "%")
1009
- end
1010
- declare :darken, [:color, :amount]
1011
-
1012
- # Makes a color more saturated. Takes a color and a number between 0% and
1013
- # 100%, and returns a color with the saturation increased by that amount.
1014
- #
1015
- # @see #desaturate
1016
- # @example
1017
- # saturate(hsl(120, 30%, 90%), 20%) => hsl(120, 50%, 90%)
1018
- # saturate(#855, 20%) => #9e3f3f
1019
- # @overload saturate($color, $amount)
1020
- # @param $color [Sass::Script::Value::Color]
1021
- # @param $amount [Sass::Script::Value::Number] The amount to increase the
1022
- # saturation by, between `0%` and `100%`
1023
- # @return [Sass::Script::Value::Color]
1024
- # @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
1025
- # is the wrong type
1026
- def saturate(color, amount = nil)
1027
- # Support the filter effects definition of saturate.
1028
- # https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html
1029
- return identifier("saturate(#{color})") if amount.nil?
1030
- _adjust(color, amount, :saturation, 0..100, :+, "%")
1031
- end
1032
- declare :saturate, [:color, :amount]
1033
- declare :saturate, [:amount]
1034
-
1035
- # Makes a color less saturated. Takes a color and a number between 0% and
1036
- # 100%, and returns a color with the saturation decreased by that value.
1037
- #
1038
- # @see #saturate
1039
- # @example
1040
- # desaturate(hsl(120, 30%, 90%), 20%) => hsl(120, 10%, 90%)
1041
- # desaturate(#855, 20%) => #726b6b
1042
- # @overload desaturate($color, $amount)
1043
- # @param $color [Sass::Script::Value::Color]
1044
- # @param $amount [Sass::Script::Value::Number] The amount to decrease the
1045
- # saturation by, between `0%` and `100%`
1046
- # @return [Sass::Script::Value::Color]
1047
- # @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
1048
- # is the wrong type
1049
- def desaturate(color, amount)
1050
- _adjust(color, amount, :saturation, 0..100, :-, "%")
1051
- end
1052
- declare :desaturate, [:color, :amount]
1053
-
1054
- # Changes the hue of a color. Takes a color and a number of degrees (usually
1055
- # between `-360deg` and `360deg`), and returns a color with the hue rotated
1056
- # along the color wheel by that amount.
1057
- #
1058
- # @example
1059
- # adjust-hue(hsl(120, 30%, 90%), 60deg) => hsl(180, 30%, 90%)
1060
- # adjust-hue(hsl(120, 30%, 90%), -60deg) => hsl(60, 30%, 90%)
1061
- # adjust-hue(#811, 45deg) => #886a11
1062
- # @overload adjust_hue($color, $degrees)
1063
- # @param $color [Sass::Script::Value::Color]
1064
- # @param $degrees [Sass::Script::Value::Number] The number of degrees to
1065
- # rotate the hue
1066
- # @return [Sass::Script::Value::Color]
1067
- # @raise [ArgumentError] if either parameter is the wrong type
1068
- def adjust_hue(color, degrees)
1069
- assert_type color, :Color, :color
1070
- assert_type degrees, :Number, :degrees
1071
- color.with(:hue => color.hue + degrees.value)
1072
- end
1073
- declare :adjust_hue, [:color, :degrees]
1074
-
1075
- # Converts a color into the format understood by IE filters.
1076
- #
1077
- # @example
1078
- # ie-hex-str(#abc) => #FFAABBCC
1079
- # ie-hex-str(#3322BB) => #FF3322BB
1080
- # ie-hex-str(rgba(0, 255, 0, 0.5)) => #8000FF00
1081
- # @overload ie_hex_str($color)
1082
- # @param $color [Sass::Script::Value::Color]
1083
- # @return [Sass::Script::Value::String] The IE-formatted string
1084
- # representation of the color
1085
- # @raise [ArgumentError] if `$color` isn't a color
1086
- def ie_hex_str(color)
1087
- assert_type color, :Color, :color
1088
- alpha = Sass::Util.round(color.alpha * 255).to_s(16).rjust(2, '0')
1089
- identifier("##{alpha}#{color.send(:hex_str)[1..-1]}".upcase)
1090
- end
1091
- declare :ie_hex_str, [:color]
1092
-
1093
- # Increases or decreases one or more properties of a color. This can change
1094
- # the red, green, blue, hue, saturation, value, and alpha properties. The
1095
- # properties are specified as keyword arguments, and are added to or
1096
- # subtracted from the color's current value for that property.
1097
- #
1098
- # All properties are optional. You can't specify both RGB properties
1099
- # (`$red`, `$green`, `$blue`) and HSL properties (`$hue`, `$saturation`,
1100
- # `$value`) at the same time.
1101
- #
1102
- # @example
1103
- # adjust-color(#102030, $blue: 5) => #102035
1104
- # adjust-color(#102030, $red: -5, $blue: 5) => #0b2035
1105
- # adjust-color(hsl(25, 100%, 80%), $lightness: -30%, $alpha: -0.4) => hsla(25, 100%, 50%, 0.6)
1106
- # @overload adjust_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
1107
- # @param $color [Sass::Script::Value::Color]
1108
- # @param $red [Sass::Script::Value::Number] The adjustment to make on the
1109
- # red component, between -255 and 255 inclusive
1110
- # @param $green [Sass::Script::Value::Number] The adjustment to make on the
1111
- # green component, between -255 and 255 inclusive
1112
- # @param $blue [Sass::Script::Value::Number] The adjustment to make on the
1113
- # blue component, between -255 and 255 inclusive
1114
- # @param $hue [Sass::Script::Value::Number] The adjustment to make on the
1115
- # hue component, in degrees
1116
- # @param $saturation [Sass::Script::Value::Number] The adjustment to make on
1117
- # the saturation component, between `-100%` and `100%` inclusive
1118
- # @param $lightness [Sass::Script::Value::Number] The adjustment to make on
1119
- # the lightness component, between `-100%` and `100%` inclusive
1120
- # @param $alpha [Sass::Script::Value::Number] The adjustment to make on the
1121
- # alpha component, between -1 and 1 inclusive
1122
- # @return [Sass::Script::Value::Color]
1123
- # @raise [ArgumentError] if any parameter is the wrong type or out-of
1124
- # bounds, or if RGB properties and HSL properties are adjusted at the
1125
- # same time
1126
- def adjust_color(color, kwargs)
1127
- assert_type color, :Color, :color
1128
- with = Sass::Util.map_hash(
1129
- "red" => [-255..255, ""],
1130
- "green" => [-255..255, ""],
1131
- "blue" => [-255..255, ""],
1132
- "hue" => nil,
1133
- "saturation" => [-100..100, "%"],
1134
- "lightness" => [-100..100, "%"],
1135
- "alpha" => [-1..1, ""]
1136
- ) do |name, (range, units)|
1137
- val = kwargs.delete(name)
1138
- next unless val
1139
- assert_type val, :Number, name
1140
- Sass::Util.check_range("$#{name}: Amount", range, val, units) if range
1141
- adjusted = color.send(name) + val.value
1142
- adjusted = [0, Sass::Util.restrict(adjusted, range)].max if range
1143
- [name.to_sym, adjusted]
1144
- end
1145
-
1146
- unless kwargs.empty?
1147
- name, val = kwargs.to_a.first
1148
- raise ArgumentError.new("Unknown argument $#{name} (#{val})")
1149
- end
1150
-
1151
- color.with(with)
1152
- end
1153
- declare :adjust_color, [:color], :var_kwargs => true
1154
-
1155
- # Fluidly scales one or more properties of a color. Unlike
1156
- # \{#adjust_color adjust-color}, which changes a color's properties by fixed
1157
- # amounts, \{#scale_color scale-color} fluidly changes them based on how
1158
- # high or low they already are. That means that lightening an already-light
1159
- # color with \{#scale_color scale-color} won't change the lightness much,
1160
- # but lightening a dark color by the same amount will change it more
1161
- # dramatically. This has the benefit of making `scale-color($color, ...)`
1162
- # have a similar effect regardless of what `$color` is.
1163
- #
1164
- # For example, the lightness of a color can be anywhere between `0%` and
1165
- # `100%`. If `scale-color($color, $lightness: 40%)` is called, the resulting
1166
- # color's lightness will be 40% of the way between its original lightness
1167
- # and 100. If `scale-color($color, $lightness: -40%)` is called instead, the
1168
- # lightness will be 40% of the way between the original and 0.
1169
- #
1170
- # This can change the red, green, blue, saturation, value, and alpha
1171
- # properties. The properties are specified as keyword arguments. All
1172
- # arguments should be percentages between `0%` and `100%`.
1173
- #
1174
- # All properties are optional. You can't specify both RGB properties
1175
- # (`$red`, `$green`, `$blue`) and HSL properties (`$saturation`, `$value`)
1176
- # at the same time.
1177
- #
1178
- # @example
1179
- # scale-color(hsl(120, 70%, 80%), $lightness: 50%) => hsl(120, 70%, 90%)
1180
- # scale-color(rgb(200, 150%, 170%), $green: -40%, $blue: 70%) => rgb(200, 90, 229)
1181
- # scale-color(hsl(200, 70%, 80%), $saturation: -90%, $alpha: -30%) => hsla(200, 7%, 80%, 0.7)
1182
- # @overload scale_color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])
1183
- # @param $color [Sass::Script::Value::Color]
1184
- # @param $red [Sass::Script::Value::Number]
1185
- # @param $green [Sass::Script::Value::Number]
1186
- # @param $blue [Sass::Script::Value::Number]
1187
- # @param $saturation [Sass::Script::Value::Number]
1188
- # @param $lightness [Sass::Script::Value::Number]
1189
- # @param $alpha [Sass::Script::Value::Number]
1190
- # @return [Sass::Script::Value::Color]
1191
- # @raise [ArgumentError] if any parameter is the wrong type or out-of
1192
- # bounds, or if RGB properties and HSL properties are adjusted at the
1193
- # same time
1194
- def scale_color(color, kwargs)
1195
- assert_type color, :Color, :color
1196
- with = Sass::Util.map_hash(
1197
- "red" => 255,
1198
- "green" => 255,
1199
- "blue" => 255,
1200
- "saturation" => 100,
1201
- "lightness" => 100,
1202
- "alpha" => 1
1203
- ) do |name, max|
1204
- val = kwargs.delete(name)
1205
- next unless val
1206
- assert_type val, :Number, name
1207
- assert_unit val, '%', name
1208
- Sass::Util.check_range("$#{name}: Amount", -100..100, val, '%')
1209
-
1210
- current = color.send(name)
1211
- scale = val.value / 100.0
1212
- diff = scale > 0 ? max - current : current
1213
- [name.to_sym, current + diff * scale]
1214
- end
1215
-
1216
- unless kwargs.empty?
1217
- name, val = kwargs.to_a.first
1218
- raise ArgumentError.new("Unknown argument $#{name} (#{val})")
1219
- end
1220
-
1221
- color.with(with)
1222
- end
1223
- declare :scale_color, [:color], :var_kwargs => true
1224
-
1225
- # Changes one or more properties of a color. This can change the red, green,
1226
- # blue, hue, saturation, value, and alpha properties. The properties are
1227
- # specified as keyword arguments, and replace the color's current value for
1228
- # that property.
1229
- #
1230
- # All properties are optional. You can't specify both RGB properties
1231
- # (`$red`, `$green`, `$blue`) and HSL properties (`$hue`, `$saturation`,
1232
- # `$value`) at the same time.
1233
- #
1234
- # @example
1235
- # change-color(#102030, $blue: 5) => #102005
1236
- # change-color(#102030, $red: 120, $blue: 5) => #782005
1237
- # change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8) => hsla(25, 100%, 40%, 0.8)
1238
- # @overload change_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
1239
- # @param $color [Sass::Script::Value::Color]
1240
- # @param $red [Sass::Script::Value::Number] The new red component for the
1241
- # color, within 0 and 255 inclusive
1242
- # @param $green [Sass::Script::Value::Number] The new green component for
1243
- # the color, within 0 and 255 inclusive
1244
- # @param $blue [Sass::Script::Value::Number] The new blue component for the
1245
- # color, within 0 and 255 inclusive
1246
- # @param $hue [Sass::Script::Value::Number] The new hue component for the
1247
- # color, in degrees
1248
- # @param $saturation [Sass::Script::Value::Number] The new saturation
1249
- # component for the color, between `0%` and `100%` inclusive
1250
- # @param $lightness [Sass::Script::Value::Number] The new lightness
1251
- # component for the color, within `0%` and `100%` inclusive
1252
- # @param $alpha [Sass::Script::Value::Number] The new alpha component for
1253
- # the color, within 0 and 1 inclusive
1254
- # @return [Sass::Script::Value::Color]
1255
- # @raise [ArgumentError] if any parameter is the wrong type or out-of
1256
- # bounds, or if RGB properties and HSL properties are adjusted at the
1257
- # same time
1258
- def change_color(color, kwargs)
1259
- assert_type color, :Color, :color
1260
- with = Sass::Util.map_hash(
1261
- 'red' => ['Red value', 0..255],
1262
- 'green' => ['Green value', 0..255],
1263
- 'blue' => ['Blue value', 0..255],
1264
- 'hue' => [],
1265
- 'saturation' => ['Saturation', 0..100, '%'],
1266
- 'lightness' => ['Lightness', 0..100, '%'],
1267
- 'alpha' => ['Alpha channel', 0..1]
1268
- ) do |name, (desc, range, unit)|
1269
- val = kwargs.delete(name)
1270
- next unless val
1271
- assert_type val, :Number, name
1272
-
1273
- if range
1274
- val = Sass::Util.check_range(desc, range, val, unit)
1275
- else
1276
- val = val.value
1277
- end
1278
-
1279
- [name.to_sym, val]
1280
- end
1281
-
1282
- unless kwargs.empty?
1283
- name, val = kwargs.to_a.first
1284
- raise ArgumentError.new("Unknown argument $#{name} (#{val})")
1285
- end
1286
-
1287
- color.with(with)
1288
- end
1289
- declare :change_color, [:color], :var_kwargs => true
1290
-
1291
- # Mixes two colors together. Specifically, takes the average of each of the
1292
- # RGB components, optionally weighted by the given percentage. The opacity
1293
- # of the colors is also considered when weighting the components.
1294
- #
1295
- # The weight specifies the amount of the first color that should be included
1296
- # in the returned color. The default, `50%`, means that half the first color
1297
- # and half the second color should be used. `25%` means that a quarter of
1298
- # the first color and three quarters of the second color should be used.
1299
- #
1300
- # @example
1301
- # mix(#f00, #00f) => #7f007f
1302
- # mix(#f00, #00f, 25%) => #3f00bf
1303
- # mix(rgba(255, 0, 0, 0.5), #00f) => rgba(63, 0, 191, 0.75)
1304
- # @overload mix($color1, $color2, $weight: 50%)
1305
- # @param $color1 [Sass::Script::Value::Color]
1306
- # @param $color2 [Sass::Script::Value::Color]
1307
- # @param $weight [Sass::Script::Value::Number] The relative weight of each
1308
- # color. Closer to `100%` gives more weight to `$color1`, closer to `0%`
1309
- # gives more weight to `$color2`
1310
- # @return [Sass::Script::Value::Color]
1311
- # @raise [ArgumentError] if `$weight` is out of bounds or any parameter is
1312
- # the wrong type
1313
- def mix(color1, color2, weight = number(50))
1314
- assert_type color1, :Color, :color1
1315
- assert_type color2, :Color, :color2
1316
- assert_type weight, :Number, :weight
1317
-
1318
- Sass::Util.check_range("Weight", 0..100, weight, '%')
1319
-
1320
- # This algorithm factors in both the user-provided weight (w) and the
1321
- # difference between the alpha values of the two colors (a) to decide how
1322
- # to perform the weighted average of the two RGB values.
1323
- #
1324
- # It works by first normalizing both parameters to be within [-1, 1],
1325
- # where 1 indicates "only use color1", -1 indicates "only use color2", and
1326
- # all values in between indicated a proportionately weighted average.
1327
- #
1328
- # Once we have the normalized variables w and a, we apply the formula
1329
- # (w + a)/(1 + w*a) to get the combined weight (in [-1, 1]) of color1.
1330
- # This formula has two especially nice properties:
1331
- #
1332
- # * When either w or a are -1 or 1, the combined weight is also that number
1333
- # (cases where w * a == -1 are undefined, and handled as a special case).
1334
- #
1335
- # * When a is 0, the combined weight is w, and vice versa.
1336
- #
1337
- # Finally, the weight of color1 is renormalized to be within [0, 1]
1338
- # and the weight of color2 is given by 1 minus the weight of color1.
1339
- p = (weight.value / 100.0).to_f
1340
- w = p * 2 - 1
1341
- a = color1.alpha - color2.alpha
1342
-
1343
- w1 = ((w * a == -1 ? w : (w + a) / (1 + w * a)) + 1) / 2.0
1344
- w2 = 1 - w1
1345
-
1346
- rgba = color1.rgb.zip(color2.rgb).map {|v1, v2| v1 * w1 + v2 * w2}
1347
- rgba << color1.alpha * p + color2.alpha * (1 - p)
1348
- rgb_color(*rgba)
1349
- end
1350
- declare :mix, [:color1, :color2]
1351
- declare :mix, [:color1, :color2, :weight]
1352
-
1353
- # Converts a color to grayscale. This is identical to `desaturate(color,
1354
- # 100%)`.
1355
- #
1356
- # @see #desaturate
1357
- # @overload grayscale($color)
1358
- # @param $color [Sass::Script::Value::Color]
1359
- # @return [Sass::Script::Value::Color]
1360
- # @raise [ArgumentError] if `$color` isn't a color
1361
- def grayscale(color)
1362
- if color.is_a?(Sass::Script::Value::Number)
1363
- return identifier("grayscale(#{color})")
1364
- end
1365
- desaturate color, number(100)
1366
- end
1367
- declare :grayscale, [:color]
1368
-
1369
- # Returns the complement of a color. This is identical to `adjust-hue(color,
1370
- # 180deg)`.
1371
- #
1372
- # @see #adjust_hue #adjust-hue
1373
- # @overload complement($color)
1374
- # @param $color [Sass::Script::Value::Color]
1375
- # @return [Sass::Script::Value::Color]
1376
- # @raise [ArgumentError] if `$color` isn't a color
1377
- def complement(color)
1378
- adjust_hue color, number(180)
1379
- end
1380
- declare :complement, [:color]
1381
-
1382
- # Returns the inverse (negative) of a color. The red, green, and blue values
1383
- # are inverted, while the opacity is left alone.
1384
- #
1385
- # @overload invert($color)
1386
- # @param $color [Sass::Script::Value::Color]
1387
- # @return [Sass::Script::Value::Color]
1388
- # @raise [ArgumentError] if `$color` isn't a color
1389
- def invert(color)
1390
- if color.is_a?(Sass::Script::Value::Number)
1391
- return identifier("invert(#{color})")
1392
- end
1393
-
1394
- assert_type color, :Color, :color
1395
- color.with(
1396
- :red => (255 - color.red),
1397
- :green => (255 - color.green),
1398
- :blue => (255 - color.blue))
1399
- end
1400
- declare :invert, [:color]
1401
-
1402
- # Removes quotes from a string. If the string is already unquoted, this will
1403
- # return it unmodified.
1404
- #
1405
- # @see #quote
1406
- # @example
1407
- # unquote("foo") => foo
1408
- # unquote(foo) => foo
1409
- # @overload unquote($string)
1410
- # @param $string [Sass::Script::Value::String]
1411
- # @return [Sass::Script::Value::String]
1412
- # @raise [ArgumentError] if `$string` isn't a string
1413
- def unquote(string)
1414
- unless string.is_a?(Sass::Script::Value::String)
1415
- # Don't warn multiple times for the same source line.
1416
- # rubocop:disable GlobalVars
1417
- $_sass_warned_for_unquote ||= Set.new
1418
- frame = environment.stack.frames.last
1419
- key = [frame.filename, frame.line] if frame
1420
- return string if frame && $_sass_warned_for_unquote.include?(key)
1421
- $_sass_warned_for_unquote << key if frame
1422
- # rubocop:enable GlobalVars
1423
-
1424
- Sass::Util.sass_warn(<<MESSAGE.strip)
1425
- DEPRECATION WARNING: Passing #{string.to_sass}, a non-string value, to unquote()
1426
- will be an error in future versions of Sass.
1427
- #{environment.stack.to_s.gsub(/^/, ' ' * 8)}
1428
- MESSAGE
1429
- return string
1430
- end
1431
-
1432
- string.check_deprecated_interp
1433
- return string if string.type == :identifier
1434
- identifier(string.value)
1435
- end
1436
- declare :unquote, [:string]
1437
-
1438
- # Add quotes to a string if the string isn't quoted,
1439
- # or returns the same string if it is.
1440
- #
1441
- # @see #unquote
1442
- # @example
1443
- # quote("foo") => "foo"
1444
- # quote(foo) => "foo"
1445
- # @overload quote($string)
1446
- # @param $string [Sass::Script::Value::String]
1447
- # @return [Sass::Script::Value::String]
1448
- # @raise [ArgumentError] if `$string` isn't a string
1449
- def quote(string)
1450
- assert_type string, :String, :string
1451
- if string.type != :string
1452
- quoted_string(string.value)
1453
- else
1454
- string
1455
- end
1456
- end
1457
- declare :quote, [:string]
1458
-
1459
- # Returns the number of characters in a string.
1460
- #
1461
- # @example
1462
- # str-length("foo") => 3
1463
- # @overload str_length($string)
1464
- # @param $string [Sass::Script::Value::String]
1465
- # @return [Sass::Script::Value::Number]
1466
- # @raise [ArgumentError] if `$string` isn't a string
1467
- def str_length(string)
1468
- assert_type string, :String, :string
1469
- number(string.value.size)
1470
- end
1471
- declare :str_length, [:string]
1472
-
1473
- # Inserts `$insert` into `$string` at `$index`.
1474
- #
1475
- # Note that unlike some languages, the first character in a Sass string is
1476
- # number 1, the second number 2, and so forth.
1477
- #
1478
- # @example
1479
- # str-insert("abcd", "X", 1) => "Xabcd"
1480
- # str-insert("abcd", "X", 4) => "abcXd"
1481
- # str-insert("abcd", "X", 5) => "abcdX"
1482
- #
1483
- # @overload str_insert($string, $insert, $index)
1484
- # @param $string [Sass::Script::Value::String]
1485
- # @param $insert [Sass::Script::Value::String]
1486
- # @param $index [Sass::Script::Value::Number] The position at which
1487
- # `$insert` will be inserted. Negative indices count from the end of
1488
- # `$string`. An index that's outside the bounds of the string will insert
1489
- # `$insert` at the front or back of the string
1490
- # @return [Sass::Script::Value::String] The result string. This will be
1491
- # quoted if and only if `$string` was quoted
1492
- # @raise [ArgumentError] if any parameter is the wrong type
1493
- def str_insert(original, insert, index)
1494
- assert_type original, :String, :string
1495
- assert_type insert, :String, :insert
1496
- assert_integer index, :index
1497
- assert_unit index, nil, :index
1498
- insertion_point = if index.to_i > 0
1499
- [index.to_i - 1, original.value.size].min
1500
- else
1501
- [index.to_i, -original.value.size - 1].max
1502
- end
1503
- result = original.value.dup.insert(insertion_point, insert.value)
1504
- Sass::Script::Value::String.new(result, original.type)
1505
- end
1506
- declare :str_insert, [:string, :insert, :index]
1507
-
1508
- # Returns the index of the first occurrence of `$substring` in `$string`. If
1509
- # there is no such occurrence, returns `null`.
1510
- #
1511
- # Note that unlike some languages, the first character in a Sass string is
1512
- # number 1, the second number 2, and so forth.
1513
- #
1514
- # @example
1515
- # str-index(abcd, a) => 1
1516
- # str-index(abcd, ab) => 1
1517
- # str-index(abcd, X) => null
1518
- # str-index(abcd, c) => 3
1519
- #
1520
- # @overload str_index($string, $substring)
1521
- # @param $string [Sass::Script::Value::String]
1522
- # @param $substring [Sass::Script::Value::String]
1523
- # @return [Sass::Script::Value::Number, Sass::Script::Value::Null]
1524
- # @raise [ArgumentError] if any parameter is the wrong type
1525
- def str_index(string, substring)
1526
- assert_type string, :String, :string
1527
- assert_type substring, :String, :substring
1528
- index = string.value.index(substring.value)
1529
- index ? number(index + 1) : null
1530
- end
1531
- declare :str_index, [:string, :substring]
1532
-
1533
- # Extracts a substring from `$string`. The substring will begin at index
1534
- # `$start-at` and ends at index `$end-at`.
1535
- #
1536
- # Note that unlike some languages, the first character in a Sass string is
1537
- # number 1, the second number 2, and so forth.
1538
- #
1539
- # @example
1540
- # str-slice("abcd", 2, 3) => "bc"
1541
- # str-slice("abcd", 2) => "bcd"
1542
- # str-slice("abcd", -3, -2) => "bc"
1543
- # str-slice("abcd", 2, -2) => "bc"
1544
- #
1545
- # @overload str_slice($string, $start-at, $end-at: -1)
1546
- # @param $start-at [Sass::Script::Value::Number] The index of the first
1547
- # character of the substring. If this is negative, it counts from the end
1548
- # of `$string`
1549
- # @param $end-at [Sass::Script::Value::Number] The index of the last
1550
- # character of the substring. If this is negative, it counts from the end
1551
- # of `$string`. Defaults to -1
1552
- # @return [Sass::Script::Value::String] The substring. This will be quoted
1553
- # if and only if `$string` was quoted
1554
- # @raise [ArgumentError] if any parameter is the wrong type
1555
- def str_slice(string, start_at, end_at = nil)
1556
- assert_type string, :String, :string
1557
- assert_unit start_at, nil, "start-at"
1558
-
1559
- end_at = number(-1) if end_at.nil?
1560
- assert_unit end_at, nil, "end-at"
1561
-
1562
- return Sass::Script::Value::String.new("", string.type) if end_at.value == 0
1563
- s = start_at.value > 0 ? start_at.value - 1 : start_at.value
1564
- e = end_at.value > 0 ? end_at.value - 1 : end_at.value
1565
- s = string.value.length + s if s < 0
1566
- s = 0 if s < 0
1567
- e = string.value.length + e if e < 0
1568
- return Sass::Script::Value::String.new("", string.type) if e < 0
1569
- extracted = string.value.slice(s..e)
1570
- Sass::Script::Value::String.new(extracted || "", string.type)
1571
- end
1572
- declare :str_slice, [:string, :start_at]
1573
- declare :str_slice, [:string, :start_at, :end_at]
1574
-
1575
- # Converts a string to upper case.
1576
- #
1577
- # @example
1578
- # to-upper-case(abcd) => ABCD
1579
- #
1580
- # @overload to_upper_case($string)
1581
- # @param $string [Sass::Script::Value::String]
1582
- # @return [Sass::Script::Value::String]
1583
- # @raise [ArgumentError] if `$string` isn't a string
1584
- def to_upper_case(string)
1585
- assert_type string, :String, :string
1586
- Sass::Script::Value::String.new(Sass::Util.upcase(string.value), string.type)
1587
- end
1588
- declare :to_upper_case, [:string]
1589
-
1590
- # Convert a string to lower case,
1591
- #
1592
- # @example
1593
- # to-lower-case(ABCD) => abcd
1594
- #
1595
- # @overload to_lower_case($string)
1596
- # @param $string [Sass::Script::Value::String]
1597
- # @return [Sass::Script::Value::String]
1598
- # @raise [ArgumentError] if `$string` isn't a string
1599
- def to_lower_case(string)
1600
- assert_type string, :String, :string
1601
- Sass::Script::Value::String.new(Sass::Util.downcase(string.value), string.type)
1602
- end
1603
- declare :to_lower_case, [:string]
1604
-
1605
- # Returns the type of a value.
1606
- #
1607
- # @example
1608
- # type-of(100px) => number
1609
- # type-of(asdf) => string
1610
- # type-of("asdf") => string
1611
- # type-of(true) => bool
1612
- # type-of(#fff) => color
1613
- # type-of(blue) => color
1614
- # type-of(null) => null
1615
- # @overload type_of($value)
1616
- # @param $value [Sass::Script::Value::Base] The value to inspect
1617
- # @return [Sass::Script::Value::String] The unquoted string name of the
1618
- # value's type
1619
- def type_of(value)
1620
- value.check_deprecated_interp if value.is_a?(Sass::Script::Value::String)
1621
- identifier(value.class.name.gsub(/Sass::Script::Value::/, '').downcase)
1622
- end
1623
- declare :type_of, [:value]
1624
-
1625
- # Returns whether a feature exists in the current Sass runtime.
1626
- #
1627
- # The following features are supported:
1628
- #
1629
- # * `global-variable-shadowing` indicates that a local variable will shadow
1630
- # a global variable unless `!global` is used.
1631
- #
1632
- # * `extend-selector-pseudoclass` indicates that `@extend` will reach into
1633
- # selector pseudoclasses like `:not`.
1634
- #
1635
- # * `units-level-3` indicates full support for unit arithmetic using units
1636
- # defined in the [Values and Units Level 3][] spec.
1637
- #
1638
- # [Values and Units Level 3]: http://www.w3.org/TR/css3-values/
1639
- #
1640
- # * `at-error` indicates that the Sass `@error` directive is supported.
1641
- #
1642
- # @example
1643
- # feature-exists(some-feature-that-exists) => true
1644
- # feature-exists(what-is-this-i-dont-know) => false
1645
- #
1646
- # @overload feature_exists($feature)
1647
- # @param $feature [Sass::Script::Value::String] The name of the feature
1648
- # @return [Sass::Script::Value::Bool] Whether the feature is supported in this version of Sass
1649
- # @raise [ArgumentError] if `$feature` isn't a string
1650
- def feature_exists(feature)
1651
- assert_type feature, :String, :feature
1652
- bool(Sass.has_feature?(feature.value))
1653
- end
1654
- declare :feature_exists, [:feature]
1655
-
1656
- # Returns the unit(s) associated with a number. Complex units are sorted in
1657
- # alphabetical order by numerator and denominator.
1658
- #
1659
- # @example
1660
- # unit(100) => ""
1661
- # unit(100px) => "px"
1662
- # unit(3em) => "em"
1663
- # unit(10px * 5em) => "em*px"
1664
- # unit(10px * 5em / 30cm / 1rem) => "em*px/cm*rem"
1665
- # @overload unit($number)
1666
- # @param $number [Sass::Script::Value::Number]
1667
- # @return [Sass::Script::Value::String] The unit(s) of the number, as a
1668
- # quoted string
1669
- # @raise [ArgumentError] if `$number` isn't a number
1670
- def unit(number)
1671
- assert_type number, :Number, :number
1672
- quoted_string(number.unit_str)
1673
- end
1674
- declare :unit, [:number]
1675
-
1676
- # Returns whether a number has units.
1677
- #
1678
- # @example
1679
- # unitless(100) => true
1680
- # unitless(100px) => false
1681
- # @overload unitless($number)
1682
- # @param $number [Sass::Script::Value::Number]
1683
- # @return [Sass::Script::Value::Bool]
1684
- # @raise [ArgumentError] if `$number` isn't a number
1685
- def unitless(number)
1686
- assert_type number, :Number, :number
1687
- bool(number.unitless?)
1688
- end
1689
- declare :unitless, [:number]
1690
-
1691
- # Returns whether two numbers can added, subtracted, or compared.
1692
- #
1693
- # @example
1694
- # comparable(2px, 1px) => true
1695
- # comparable(100px, 3em) => false
1696
- # comparable(10cm, 3mm) => true
1697
- # @overload comparable($number1, $number2)
1698
- # @param $number1 [Sass::Script::Value::Number]
1699
- # @param $number2 [Sass::Script::Value::Number]
1700
- # @return [Sass::Script::Value::Bool]
1701
- # @raise [ArgumentError] if either parameter is the wrong type
1702
- def comparable(number1, number2)
1703
- assert_type number1, :Number, :number1
1704
- assert_type number2, :Number, :number2
1705
- bool(number1.comparable_to?(number2))
1706
- end
1707
- declare :comparable, [:number1, :number2]
1708
-
1709
- # Converts a unitless number to a percentage.
1710
- #
1711
- # @example
1712
- # percentage(0.2) => 20%
1713
- # percentage(100px / 50px) => 200%
1714
- # @overload percentage($number)
1715
- # @param $number [Sass::Script::Value::Number]
1716
- # @return [Sass::Script::Value::Number]
1717
- # @raise [ArgumentError] if `$number` isn't a unitless number
1718
- def percentage(number)
1719
- unless number.is_a?(Sass::Script::Value::Number) && number.unitless?
1720
- raise ArgumentError.new("$number: #{number.inspect} is not a unitless number")
1721
- end
1722
- number(number.value * 100, '%')
1723
- end
1724
- declare :percentage, [:number]
1725
-
1726
- # Rounds a number to the nearest whole number.
1727
- #
1728
- # @example
1729
- # round(10.4px) => 10px
1730
- # round(10.6px) => 11px
1731
- # @overload round($number)
1732
- # @param $number [Sass::Script::Value::Number]
1733
- # @return [Sass::Script::Value::Number]
1734
- # @raise [ArgumentError] if `$number` isn't a number
1735
- def round(number)
1736
- numeric_transformation(number) {|n| Sass::Util.round(n)}
1737
- end
1738
- declare :round, [:number]
1739
-
1740
- # Rounds a number up to the next whole number.
1741
- #
1742
- # @example
1743
- # ceil(10.4px) => 11px
1744
- # ceil(10.6px) => 11px
1745
- # @overload ceil($number)
1746
- # @param $number [Sass::Script::Value::Number]
1747
- # @return [Sass::Script::Value::Number]
1748
- # @raise [ArgumentError] if `$number` isn't a number
1749
- def ceil(number)
1750
- numeric_transformation(number) {|n| n.ceil}
1751
- end
1752
- declare :ceil, [:number]
1753
-
1754
- # Rounds a number down to the previous whole number.
1755
- #
1756
- # @example
1757
- # floor(10.4px) => 10px
1758
- # floor(10.6px) => 10px
1759
- # @overload floor($number)
1760
- # @param $number [Sass::Script::Value::Number]
1761
- # @return [Sass::Script::Value::Number]
1762
- # @raise [ArgumentError] if `$number` isn't a number
1763
- def floor(number)
1764
- numeric_transformation(number) {|n| n.floor}
1765
- end
1766
- declare :floor, [:number]
1767
-
1768
- # Returns the absolute value of a number.
1769
- #
1770
- # @example
1771
- # abs(10px) => 10px
1772
- # abs(-10px) => 10px
1773
- # @overload abs($number)
1774
- # @param $number [Sass::Script::Value::Number]
1775
- # @return [Sass::Script::Value::Number]
1776
- # @raise [ArgumentError] if `$number` isn't a number
1777
- def abs(number)
1778
- numeric_transformation(number) {|n| n.abs}
1779
- end
1780
- declare :abs, [:number]
1781
-
1782
- # Finds the minimum of several numbers. This function takes any number of
1783
- # arguments.
1784
- #
1785
- # @example
1786
- # min(1px, 4px) => 1px
1787
- # min(5em, 3em, 4em) => 3em
1788
- # @overload min($numbers...)
1789
- # @param $numbers [[Sass::Script::Value::Number]]
1790
- # @return [Sass::Script::Value::Number]
1791
- # @raise [ArgumentError] if any argument isn't a number, or if not all of
1792
- # the arguments have comparable units
1793
- def min(*numbers)
1794
- numbers.each {|n| assert_type n, :Number}
1795
- numbers.inject {|min, num| min.lt(num).to_bool ? min : num}
1796
- end
1797
- declare :min, [], :var_args => :true
1798
-
1799
- # Finds the maximum of several numbers. This function takes any number of
1800
- # arguments.
1801
- #
1802
- # @example
1803
- # max(1px, 4px) => 4px
1804
- # max(5em, 3em, 4em) => 5em
1805
- # @overload max($numbers...)
1806
- # @param $numbers [[Sass::Script::Value::Number]]
1807
- # @return [Sass::Script::Value::Number]
1808
- # @raise [ArgumentError] if any argument isn't a number, or if not all of
1809
- # the arguments have comparable units
1810
- def max(*values)
1811
- values.each {|v| assert_type v, :Number}
1812
- values.inject {|max, val| max.gt(val).to_bool ? max : val}
1813
- end
1814
- declare :max, [], :var_args => :true
1815
-
1816
- # Return the length of a list.
1817
- #
1818
- # This can return the number of pairs in a map as well.
1819
- #
1820
- # @example
1821
- # length(10px) => 1
1822
- # length(10px 20px 30px) => 3
1823
- # length((width: 10px, height: 20px)) => 2
1824
- # @overload length($list)
1825
- # @param $list [Sass::Script::Value::Base]
1826
- # @return [Sass::Script::Value::Number]
1827
- def length(list)
1828
- number(list.to_a.size)
1829
- end
1830
- declare :length, [:list]
1831
-
1832
- # Return a new list, based on the list provided, but with the nth
1833
- # element changed to the value given.
1834
- #
1835
- # Note that unlike some languages, the first item in a Sass list is number
1836
- # 1, the second number 2, and so forth.
1837
- #
1838
- # Negative index values address elements in reverse order, starting with the last element
1839
- # in the list.
1840
- #
1841
- # @example
1842
- # set-nth($list: 10px 20px 30px, $n: 2, $value: -20px) => 10px -20px 30px
1843
- # @overload set-nth($list, $n, $value)
1844
- # @param $list [Sass::Script::Value::Base] The list that will be copied, having the element
1845
- # at index `$n` changed.
1846
- # @param $n [Sass::Script::Value::Number] The index of the item to set.
1847
- # Negative indices count from the end of the list.
1848
- # @param $value [Sass::Script::Value::Base] The new value at index `$n`.
1849
- # @return [Sass::Script::Value::List]
1850
- # @raise [ArgumentError] if `$n` isn't an integer between 1 and the length
1851
- # of `$list`
1852
- def set_nth(list, n, value)
1853
- assert_type n, :Number, :n
1854
- Sass::Script::Value::List.assert_valid_index(list, n)
1855
- index = n.to_i > 0 ? n.to_i - 1 : n.to_i
1856
- new_list = list.to_a.dup
1857
- new_list[index] = value
1858
- Sass::Script::Value::List.new(new_list, list.separator)
1859
- end
1860
- declare :set_nth, [:list, :n, :value]
1861
-
1862
- # Gets the nth item in a list.
1863
- #
1864
- # Note that unlike some languages, the first item in a Sass list is number
1865
- # 1, the second number 2, and so forth.
1866
- #
1867
- # This can return the nth pair in a map as well.
1868
- #
1869
- # Negative index values address elements in reverse order, starting with the last element in
1870
- # the list.
1871
- #
1872
- # @example
1873
- # nth(10px 20px 30px, 1) => 10px
1874
- # nth((Helvetica, Arial, sans-serif), 3) => sans-serif
1875
- # nth((width: 10px, length: 20px), 2) => length, 20px
1876
- # @overload nth($list, $n)
1877
- # @param $list [Sass::Script::Value::Base]
1878
- # @param $n [Sass::Script::Value::Number] The index of the item to get.
1879
- # Negative indices count from the end of the list.
1880
- # @return [Sass::Script::Value::Base]
1881
- # @raise [ArgumentError] if `$n` isn't an integer between 1 and the length
1882
- # of `$list`
1883
- def nth(list, n)
1884
- assert_type n, :Number, :n
1885
- Sass::Script::Value::List.assert_valid_index(list, n)
1886
-
1887
- index = n.to_i > 0 ? n.to_i - 1 : n.to_i
1888
- list.to_a[index]
1889
- end
1890
- declare :nth, [:list, :n]
1891
-
1892
- # Joins together two lists into one.
1893
- #
1894
- # Unless `$separator` is passed, if one list is comma-separated and one is
1895
- # space-separated, the first parameter's separator is used for the resulting
1896
- # list. If both lists have fewer than two items, spaces are used for the
1897
- # resulting list.
1898
- #
1899
- # Like all list functions, `join()` returns a new list rather than modifying
1900
- # its arguments in place.
1901
- #
1902
- # @example
1903
- # join(10px 20px, 30px 40px) => 10px 20px 30px 40px
1904
- # join((blue, red), (#abc, #def)) => blue, red, #abc, #def
1905
- # join(10px, 20px) => 10px 20px
1906
- # join(10px, 20px, comma) => 10px, 20px
1907
- # join((blue, red), (#abc, #def), space) => blue red #abc #def
1908
- # @overload join($list1, $list2, $separator: auto)
1909
- # @param $list1 [Sass::Script::Value::Base]
1910
- # @param $list2 [Sass::Script::Value::Base]
1911
- # @param $separator [Sass::Script::Value::String] The list separator to use.
1912
- # If this is `comma` or `space`, that separator will be used. If this is
1913
- # `auto` (the default), the separator is determined as explained above.
1914
- # @return [Sass::Script::Value::List]
1915
- def join(list1, list2, separator = identifier("auto"))
1916
- assert_type separator, :String, :separator
1917
- unless %w(auto space comma).include?(separator.value)
1918
- raise ArgumentError.new("Separator name must be space, comma, or auto")
1919
- end
1920
- sep = if separator.value == 'auto'
1921
- list1.separator || list2.separator || :space
1922
- else
1923
- separator.value.to_sym
1924
- end
1925
- list(list1.to_a + list2.to_a, sep)
1926
- end
1927
- declare :join, [:list1, :list2]
1928
- declare :join, [:list1, :list2, :separator]
1929
-
1930
- # Appends a single value onto the end of a list.
1931
- #
1932
- # Unless the `$separator` argument is passed, if the list had only one item,
1933
- # the resulting list will be space-separated.
1934
- #
1935
- # Like all list functions, `append()` returns a new list rather than
1936
- # modifying its argument in place.
1937
- #
1938
- # @example
1939
- # append(10px 20px, 30px) => 10px 20px 30px
1940
- # append((blue, red), green) => blue, red, green
1941
- # append(10px 20px, 30px 40px) => 10px 20px (30px 40px)
1942
- # append(10px, 20px, comma) => 10px, 20px
1943
- # append((blue, red), green, space) => blue red green
1944
- # @overload append($list, $val, $separator: auto)
1945
- # @param $list [Sass::Script::Value::Base]
1946
- # @param $val [Sass::Script::Value::Base]
1947
- # @param $separator [Sass::Script::Value::String] The list separator to use.
1948
- # If this is `comma` or `space`, that separator will be used. If this is
1949
- # `auto` (the default), the separator is determined as explained above.
1950
- # @return [Sass::Script::Value::List]
1951
- def append(list, val, separator = identifier("auto"))
1952
- assert_type separator, :String, :separator
1953
- unless %w(auto space comma).include?(separator.value)
1954
- raise ArgumentError.new("Separator name must be space, comma, or auto")
1955
- end
1956
- sep = if separator.value == 'auto'
1957
- list.separator || :space
1958
- else
1959
- separator.value.to_sym
1960
- end
1961
- list(list.to_a + [val], sep)
1962
- end
1963
- declare :append, [:list, :val]
1964
- declare :append, [:list, :val, :separator]
1965
-
1966
- # Combines several lists into a single multidimensional list. The nth value
1967
- # of the resulting list is a space separated list of the source lists' nth
1968
- # values.
1969
- #
1970
- # The length of the resulting list is the length of the
1971
- # shortest list.
1972
- #
1973
- # @example
1974
- # zip(1px 1px 3px, solid dashed solid, red green blue)
1975
- # => 1px solid red, 1px dashed green, 3px solid blue
1976
- # @overload zip($lists...)
1977
- # @param $lists [[Sass::Script::Value::Base]]
1978
- # @return [Sass::Script::Value::List]
1979
- def zip(*lists)
1980
- length = nil
1981
- values = []
1982
- lists.each do |list|
1983
- array = list.to_a
1984
- values << array.dup
1985
- length = length.nil? ? array.length : [length, array.length].min
1986
- end
1987
- values.each do |value|
1988
- value.slice!(length)
1989
- end
1990
- new_list_value = values.first.zip(*values[1..-1])
1991
- list(new_list_value.map {|list| list(list, :space)}, :comma)
1992
- end
1993
- declare :zip, [], :var_args => true
1994
-
1995
- # Returns the position of a value within a list. If the value isn't found,
1996
- # returns `null` instead.
1997
- #
1998
- # Note that unlike some languages, the first item in a Sass list is number
1999
- # 1, the second number 2, and so forth.
2000
- #
2001
- # This can return the position of a pair in a map as well.
2002
- #
2003
- # @example
2004
- # index(1px solid red, solid) => 2
2005
- # index(1px solid red, dashed) => null
2006
- # index((width: 10px, height: 20px), (height 20px)) => 2
2007
- # @overload index($list, $value)
2008
- # @param $list [Sass::Script::Value::Base]
2009
- # @param $value [Sass::Script::Value::Base]
2010
- # @return [Sass::Script::Value::Number, Sass::Script::Value::Null] The
2011
- # 1-based index of `$value` in `$list`, or `null`
2012
- def index(list, value)
2013
- index = list.to_a.index {|e| e.eq(value).to_bool}
2014
- index ? number(index + 1) : null
2015
- end
2016
- declare :index, [:list, :value]
2017
-
2018
- # Returns the separator of a list. If the list doesn't have a separator due
2019
- # to having fewer than two elements, returns `space`.
2020
- #
2021
- # @example
2022
- # list-separator(1px 2px 3px) => space
2023
- # list-separator(1px, 2px, 3px) => comma
2024
- # list-separator('foo') => space
2025
- # @overload list_separator($list)
2026
- # @param $list [Sass::Script::Value::Base]
2027
- # @return [Sass::Script::Value::String] `comma` or `space`
2028
- def list_separator(list)
2029
- identifier((list.separator || :space).to_s)
2030
- end
2031
- declare :separator, [:list]
2032
-
2033
- # Returns the value in a map associated with the given key. If the map
2034
- # doesn't have such a key, returns `null`.
2035
- #
2036
- # @example
2037
- # map-get(("foo": 1, "bar": 2), "foo") => 1
2038
- # map-get(("foo": 1, "bar": 2), "bar") => 2
2039
- # map-get(("foo": 1, "bar": 2), "baz") => null
2040
- # @overload map_get($map, $key)
2041
- # @param $map [Sass::Script::Value::Map]
2042
- # @param $key [Sass::Script::Value::Base]
2043
- # @return [Sass::Script::Value::Base] The value indexed by `$key`, or `null`
2044
- # if the map doesn't contain the given key
2045
- # @raise [ArgumentError] if `$map` is not a map
2046
- def map_get(map, key)
2047
- assert_type map, :Map, :map
2048
- map.to_h[key] || null
2049
- end
2050
- declare :map_get, [:map, :key]
2051
-
2052
- # Merges two maps together into a new map. Keys in `$map2` will take
2053
- # precedence over keys in `$map1`.
2054
- #
2055
- # This is the best way to add new values to a map.
2056
- #
2057
- # All keys in the returned map that also appear in `$map1` will have the
2058
- # same order as in `$map1`. New keys from `$map2` will be placed at the end
2059
- # of the map.
2060
- #
2061
- # Like all map functions, `map-merge()` returns a new map rather than
2062
- # modifying its arguments in place.
2063
- #
2064
- # @example
2065
- # map-merge(("foo": 1), ("bar": 2)) => ("foo": 1, "bar": 2)
2066
- # map-merge(("foo": 1, "bar": 2), ("bar": 3)) => ("foo": 1, "bar": 3)
2067
- # @overload map_merge($map1, $map2)
2068
- # @param $map1 [Sass::Script::Value::Map]
2069
- # @param $map2 [Sass::Script::Value::Map]
2070
- # @return [Sass::Script::Value::Map]
2071
- # @raise [ArgumentError] if either parameter is not a map
2072
- def map_merge(map1, map2)
2073
- assert_type map1, :Map, :map1
2074
- assert_type map2, :Map, :map2
2075
- map(map1.to_h.merge(map2.to_h))
2076
- end
2077
- declare :map_merge, [:map1, :map2]
2078
-
2079
- # Returns a new map with keys removed.
2080
- #
2081
- # Like all map functions, `map-merge()` returns a new map rather than
2082
- # modifying its arguments in place.
2083
- #
2084
- # @example
2085
- # map-remove(("foo": 1, "bar": 2), "bar") => ("foo": 1)
2086
- # map-remove(("foo": 1, "bar": 2, "baz": 3), "bar", "baz") => ("foo": 1)
2087
- # map-remove(("foo": 1, "bar": 2), "baz") => ("foo": 1, "bar": 2)
2088
- # @overload map_remove($map, $keys...)
2089
- # @param $map [Sass::Script::Value::Map]
2090
- # @param $keys [[Sass::Script::Value::Base]]
2091
- # @return [Sass::Script::Value::Map]
2092
- # @raise [ArgumentError] if `$map` is not a map
2093
- def map_remove(map, *keys)
2094
- assert_type map, :Map, :map
2095
- hash = map.to_h.dup
2096
- hash.delete_if {|key, _| keys.include?(key)}
2097
- map(hash)
2098
- end
2099
- declare :map_remove, [:map, :key], :var_args => true
2100
-
2101
- # Returns a list of all keys in a map.
2102
- #
2103
- # @example
2104
- # map-keys(("foo": 1, "bar": 2)) => "foo", "bar"
2105
- # @overload map_keys($map)
2106
- # @param $map [Map]
2107
- # @return [List] the list of keys, comma-separated
2108
- # @raise [ArgumentError] if `$map` is not a map
2109
- def map_keys(map)
2110
- assert_type map, :Map, :map
2111
- list(map.to_h.keys, :comma)
2112
- end
2113
- declare :map_keys, [:map]
2114
-
2115
- # Returns a list of all values in a map. This list may include duplicate
2116
- # values, if multiple keys have the same value.
2117
- #
2118
- # @example
2119
- # map-values(("foo": 1, "bar": 2)) => 1, 2
2120
- # map-values(("foo": 1, "bar": 2, "baz": 1)) => 1, 2, 1
2121
- # @overload map_values($map)
2122
- # @param $map [Map]
2123
- # @return [List] the list of values, comma-separated
2124
- # @raise [ArgumentError] if `$map` is not a map
2125
- def map_values(map)
2126
- assert_type map, :Map, :map
2127
- list(map.to_h.values, :comma)
2128
- end
2129
- declare :map_values, [:map]
2130
-
2131
- # Returns whether a map has a value associated with a given key.
2132
- #
2133
- # @example
2134
- # map-has-key(("foo": 1, "bar": 2), "foo") => true
2135
- # map-has-key(("foo": 1, "bar": 2), "baz") => false
2136
- # @overload map_has_key($map, $key)
2137
- # @param $map [Sass::Script::Value::Map]
2138
- # @param $key [Sass::Script::Value::Base]
2139
- # @return [Sass::Script::Value::Bool]
2140
- # @raise [ArgumentError] if `$map` is not a map
2141
- def map_has_key(map, key)
2142
- assert_type map, :Map, :map
2143
- bool(map.to_h.has_key?(key))
2144
- end
2145
- declare :map_has_key, [:map, :key]
2146
-
2147
- # Returns the map of named arguments passed to a function or mixin that
2148
- # takes a variable argument list. The argument names are strings, and they
2149
- # do not contain the leading `$`.
2150
- #
2151
- # @example
2152
- # @mixin foo($args...) {
2153
- # @debug keywords($args); //=> (arg1: val, arg2: val)
2154
- # }
2155
- #
2156
- # @include foo($arg1: val, $arg2: val);
2157
- # @overload keywords($args)
2158
- # @param $args [Sass::Script::Value::ArgList]
2159
- # @return [Sass::Script::Value::Map]
2160
- # @raise [ArgumentError] if `$args` isn't a variable argument list
2161
- def keywords(args)
2162
- assert_type args, :ArgList, :args
2163
- map(Sass::Util.map_keys(args.keywords.as_stored) {|k| Sass::Script::Value::String.new(k)})
2164
- end
2165
- declare :keywords, [:args]
2166
-
2167
- # Returns one of two values, depending on whether or not `$condition` is
2168
- # true. Just like in `@if`, all values other than `false` and `null` are
2169
- # considered to be true.
2170
- #
2171
- # @example
2172
- # if(true, 1px, 2px) => 1px
2173
- # if(false, 1px, 2px) => 2px
2174
- # @overload if($condition, $if-true, $if-false)
2175
- # @param $condition [Sass::Script::Value::Base] Whether the `$if-true` or
2176
- # `$if-false` will be returned
2177
- # @param $if-true [Sass::Script::Tree::Node]
2178
- # @param $if-false [Sass::Script::Tree::Node]
2179
- # @return [Sass::Script::Value::Base] `$if-true` or `$if-false`
2180
- def if(condition, if_true, if_false)
2181
- if condition.to_bool
2182
- perform(if_true)
2183
- else
2184
- perform(if_false)
2185
- end
2186
- end
2187
- declare :if, [:condition, :"&if_true", :"&if_false"]
2188
-
2189
- # Returns a unique CSS identifier. The identifier is returned as an unquoted
2190
- # string. The identifier returned is only guaranteed to be unique within the
2191
- # scope of a single Sass run.
2192
- #
2193
- # @overload unique_id()
2194
- # @return [Sass::Script::Value::String]
2195
- def unique_id
2196
- generator = Sass::Script::Functions.random_number_generator
2197
- Thread.current[:sass_last_unique_id] ||= generator.rand(36**8)
2198
- # avoid the temptation of trying to guess the next unique value.
2199
- value = (Thread.current[:sass_last_unique_id] += (generator.rand(10) + 1))
2200
- # the u makes this a legal identifier if it would otherwise start with a number.
2201
- identifier("u" + value.to_s(36).rjust(8, '0'))
2202
- end
2203
- declare :unique_id, []
2204
-
2205
- # Dynamically calls a function. This can call user-defined
2206
- # functions, built-in functions, or plain CSS functions. It will
2207
- # pass along all arguments, including keyword arguments, to the
2208
- # called function.
2209
- #
2210
- # @example
2211
- # call(rgb, 10, 100, 255) => #0a64ff
2212
- # call(scale-color, #0a64ff, $lightness: -10%) => #0058ef
2213
- #
2214
- # $fn: nth;
2215
- # call($fn, (a b c), 2) => b
2216
- #
2217
- # @overload call($name, $args...)
2218
- # @param $name [String] The name of the function to call.
2219
- def call(name, *args)
2220
- assert_type name, :String, :name
2221
- kwargs = args.last.is_a?(Hash) ? args.pop : {}
2222
- funcall = Sass::Script::Tree::Funcall.new(
2223
- name.value,
2224
- args.map {|a| Sass::Script::Tree::Literal.new(a)},
2225
- Sass::Util.map_vals(kwargs) {|v| Sass::Script::Tree::Literal.new(v)},
2226
- nil,
2227
- nil)
2228
- funcall.options = options
2229
- perform(funcall)
2230
- end
2231
- declare :call, [:name], :var_args => true, :var_kwargs => true
2232
-
2233
- # This function only exists as a workaround for IE7's [`content:
2234
- # counter` bug](http://jes.st/2013/ie7s-css-breaking-content-counter-bug/).
2235
- # It works identically to any other plain-CSS function, except it
2236
- # avoids adding spaces between the argument commas.
2237
- #
2238
- # @example
2239
- # counter(item, ".") => counter(item,".")
2240
- # @overload counter($args...)
2241
- # @return [Sass::Script::Value::String]
2242
- def counter(*args)
2243
- identifier("counter(#{args.map {|a| a.to_s(options)}.join(',')})")
2244
- end
2245
- declare :counter, [], :var_args => true
2246
-
2247
- # This function only exists as a workaround for IE7's [`content:
2248
- # counter` bug](http://jes.st/2013/ie7s-css-breaking-content-counter-bug/).
2249
- # It works identically to any other plain-CSS function, except it
2250
- # avoids adding spaces between the argument commas.
2251
- #
2252
- # @example
2253
- # counters(item, ".") => counters(item,".")
2254
- # @overload counters($args...)
2255
- # @return [Sass::Script::Value::String]
2256
- def counters(*args)
2257
- identifier("counters(#{args.map {|a| a.to_s(options)}.join(',')})")
2258
- end
2259
- declare :counters, [], :var_args => true
2260
-
2261
- # Check whether a variable with the given name exists in the current
2262
- # scope or in the global scope.
2263
- #
2264
- # @example
2265
- # $a-false-value: false;
2266
- # variable-exists(a-false-value) => true
2267
- # variable-exists(a-null-value) => true
2268
- #
2269
- # variable-exists(nonexistent) => false
2270
- #
2271
- # @overload variable_exists($name)
2272
- # @param $name [Sass::Script::Value::String] The name of the variable to
2273
- # check. The name should not include the `$`.
2274
- # @return [Sass::Script::Value::Bool] Whether the variable is defined in
2275
- # the current scope.
2276
- def variable_exists(name)
2277
- assert_type name, :String, :name
2278
- bool(environment.caller.var(name.value))
2279
- end
2280
- declare :variable_exists, [:name]
2281
-
2282
- # Check whether a variable with the given name exists in the global
2283
- # scope (at the top level of the file).
2284
- #
2285
- # @example
2286
- # $a-false-value: false;
2287
- # global-variable-exists(a-false-value) => true
2288
- # global-variable-exists(a-null-value) => true
2289
- #
2290
- # .foo {
2291
- # $some-var: false;
2292
- # @if global-variable-exists(some-var) { /* false, doesn't run */ }
2293
- # }
2294
- #
2295
- # @overload global_variable_exists($name)
2296
- # @param $name [Sass::Script::Value::String] The name of the variable to
2297
- # check. The name should not include the `$`.
2298
- # @return [Sass::Script::Value::Bool] Whether the variable is defined in
2299
- # the global scope.
2300
- def global_variable_exists(name)
2301
- assert_type name, :String, :name
2302
- bool(environment.global_env.var(name.value))
2303
- end
2304
- declare :global_variable_exists, [:name]
2305
-
2306
- # Check whether a function with the given name exists.
2307
- #
2308
- # @example
2309
- # function-exists(lighten) => true
2310
- #
2311
- # @function myfunc { @return "something"; }
2312
- # function-exists(myfunc) => true
2313
- #
2314
- # @overload function_exists($name)
2315
- # @param name [Sass::Script::Value::String] The name of the function to
2316
- # check.
2317
- # @return [Sass::Script::Value::Bool] Whether the function is defined.
2318
- def function_exists(name)
2319
- assert_type name, :String, :name
2320
- exists = Sass::Script::Functions.callable?(name.value.tr("-", "_"))
2321
- exists ||= environment.function(name.value)
2322
- bool(exists)
2323
- end
2324
- declare :function_exists, [:name]
2325
-
2326
- # Check whether a mixin with the given name exists.
2327
- #
2328
- # @example
2329
- # mixin-exists(nonexistent) => false
2330
- #
2331
- # @mixin red-text { color: red; }
2332
- # mixin-exists(red-text) => true
2333
- #
2334
- # @overload mixin_exists($name)
2335
- # @param name [Sass::Script::Value::String] The name of the mixin to
2336
- # check.
2337
- # @return [Sass::Script::Value::Bool] Whether the mixin is defined.
2338
- def mixin_exists(name)
2339
- assert_type name, :String, :name
2340
- bool(environment.mixin(name.value))
2341
- end
2342
- declare :mixin_exists, [:name]
2343
-
2344
- # Return a string containing the value as its Sass representation.
2345
- #
2346
- # @overload inspect($value)
2347
- # @param $value [Sass::Script::Value::Base] The value to inspect.
2348
- # @return [Sass::Script::Value::String] A representation of the value as
2349
- # it would be written in Sass.
2350
- def inspect(value)
2351
- value.check_deprecated_interp if value.is_a?(Sass::Script::Value::String)
2352
- unquoted_string(value.to_sass)
2353
- end
2354
- declare :inspect, [:value]
2355
-
2356
- # @overload random()
2357
- # Return a decimal between 0 and 1, inclusive of 0 but not 1.
2358
- # @return [Sass::Script::Value::Number] A decimal value.
2359
- # @overload random($limit)
2360
- # Return an integer between 1 and `$limit`, inclusive of both 1 and `$limit`.
2361
- # @param $limit [Sass::Script::Value::Number] The maximum of the random integer to be
2362
- # returned, a positive integer.
2363
- # @return [Sass::Script::Value::Number] An integer.
2364
- # @raise [ArgumentError] if the `$limit` is not 1 or greater
2365
- def random(limit = nil)
2366
- generator = Sass::Script::Functions.random_number_generator
2367
- if limit
2368
- assert_integer limit, "limit"
2369
- if limit.to_i < 1
2370
- raise ArgumentError.new("$limit #{limit} must be greater than or equal to 1")
2371
- end
2372
- number(1 + generator.rand(limit.to_i))
2373
- else
2374
- number(generator.rand)
2375
- end
2376
- end
2377
- declare :random, []
2378
- declare :random, [:limit]
2379
-
2380
- # Parses a user-provided selector into a list of lists of strings
2381
- # as returned by `&`.
2382
- #
2383
- # @example
2384
- # selector-parse(".foo .bar, .baz .bang") => ('.foo' '.bar', '.baz' '.bang')
2385
- #
2386
- # @overload selector_parse($selector)
2387
- # @param $selector [Sass::Script::Value::String, Sass::Script::Value::List]
2388
- # The selector to parse. This can be either a string, a list of
2389
- # strings, or a list of lists of strings as returned by `&`.
2390
- # @return [Sass::Script::Value::List]
2391
- # A list of lists of strings representing `$selector`. This is
2392
- # in the same format as a selector returned by `&`.
2393
- def selector_parse(selector)
2394
- parse_selector(selector, :selector).to_sass_script
2395
- end
2396
- declare :selector_parse, [:selector]
2397
-
2398
- # Return a new selector with all selectors in `$selectors` nested beneath
2399
- # one another as though they had been nested in the stylesheet as
2400
- # `$selector1 { $selector2 { ... } }`.
2401
- #
2402
- # Unlike most selector functions, `selector-nest` allows the
2403
- # parent selector `&` to be used in any selector but the first.
2404
- #
2405
- # @example
2406
- # selector-nest(".foo", ".bar", ".baz") => .foo .bar .baz
2407
- # selector-nest(".a .foo", ".b .bar") => .a .foo .b .bar
2408
- # selector-nest(".foo", "&.bar") => .foo.bar
2409
- #
2410
- # @overload selector_nest($selectors...)
2411
- # @param $selectors [[Sass::Script::Value::String, Sass::Script::Value::List]]
2412
- # The selectors to nest. At least one selector must be passed. Each of
2413
- # these can be either a string, a list of strings, or a list of lists of
2414
- # strings as returned by `&`.
2415
- # @return [Sass::Script::Value::List]
2416
- # A list of lists of strings representing the result of nesting
2417
- # `$selectors`. This is in the same format as a selector returned by
2418
- # `&`.
2419
- def selector_nest(*selectors)
2420
- if selectors.empty?
2421
- raise ArgumentError.new("$selectors: At least one selector must be passed")
2422
- end
2423
-
2424
- parsed = [parse_selector(selectors.first, :selectors)]
2425
- parsed += selectors[1..-1].map {|sel| parse_selector(sel, :selectors, true)}
2426
- parsed.inject {|result, child| child.resolve_parent_refs(result)}.to_sass_script
2427
- end
2428
- declare :selector_nest, [], :var_args => true
2429
-
2430
- # Return a new selector with all selectors in `$selectors` appended one
2431
- # another as though they had been nested in the stylesheet as `$selector1 {
2432
- # &$selector2 { ... } }`.
2433
- #
2434
- # @example
2435
- # selector-append(".foo", ".bar", ".baz") => .foo.bar.baz
2436
- # selector-append(".a .foo", ".b .bar") => "a .foo.b .bar"
2437
- # selector-append(".foo", "-suffix") => ".foo-suffix"
2438
- #
2439
- # @overload selector_append($selectors...)
2440
- # @param $selectors [[Sass::Script::Value::String, Sass::Script::Value::List]]
2441
- # The selectors to append. At least one selector must be passed. Each of
2442
- # these can be either a string, a list of strings, or a list of lists of
2443
- # strings as returned by `&`.
2444
- # @return [Sass::Script::Value::List]
2445
- # A list of lists of strings representing the result of appending
2446
- # `$selectors`. This is in the same format as a selector returned by
2447
- # `&`.
2448
- # @raise [ArgumentError] if a selector could not be appended.
2449
- def selector_append(*selectors)
2450
- if selectors.empty?
2451
- raise ArgumentError.new("$selectors: At least one selector must be passed")
2452
- end
2453
-
2454
- selectors.map {|sel| parse_selector(sel, :selectors)}.inject do |parent, child|
2455
- child.members.each do |seq|
2456
- sseq = seq.members.first
2457
- unless sseq.is_a?(Sass::Selector::SimpleSequence)
2458
- raise ArgumentError.new("Can't append \"#{seq}\" to \"#{parent}\"")
2459
- end
2460
-
2461
- base = sseq.base
2462
- case base
2463
- when Sass::Selector::Universal
2464
- raise ArgumentError.new("Can't append \"#{seq}\" to \"#{parent}\"")
2465
- when Sass::Selector::Element
2466
- unless base.namespace.nil?
2467
- raise ArgumentError.new("Can't append \"#{seq}\" to \"#{parent}\"")
2468
- end
2469
- sseq.members[0] = Sass::Selector::Parent.new(base.name)
2470
- else
2471
- sseq.members.unshift Sass::Selector::Parent.new
2472
- end
2473
- end
2474
- child.resolve_parent_refs(parent)
2475
- end.to_sass_script
2476
- end
2477
- declare :selector_append, [], :var_args => true
2478
-
2479
- # Returns a new version of `$selector` with `$extendee` extended
2480
- # with `$extender`. This works just like the result of
2481
- #
2482
- # $selector { ... }
2483
- # $extender { @extend $extendee }
2484
- #
2485
- # @example
2486
- # selector-extend(".a .b", ".b", ".foo .bar") => .a .b, .a .foo .bar, .foo .a .bar
2487
- #
2488
- # @overload selector_extend($selector, $extendee, $extender)
2489
- # @param $selector [Sass::Script::Value::String, Sass::Script::Value::List]
2490
- # The selector within which `$extendee` is extended with
2491
- # `$extender`. This can be either a string, a list of strings,
2492
- # or a list of lists of strings as returned by `&`.
2493
- # @param $extendee [Sass::Script::Value::String, Sass::Script::Value::List]
2494
- # The selector being extended. This can be either a string, a
2495
- # list of strings, or a list of lists of strings as returned
2496
- # by `&`.
2497
- # @param $extender [Sass::Script::Value::String, Sass::Script::Value::List]
2498
- # The selector being injected into `$selector`. This can be
2499
- # either a string, a list of strings, or a list of lists of
2500
- # strings as returned by `&`.
2501
- # @return [Sass::Script::Value::List]
2502
- # A list of lists of strings representing the result of the
2503
- # extension. This is in the same format as a selector returned
2504
- # by `&`.
2505
- # @raise [ArgumentError] if the extension fails
2506
- def selector_extend(selector, extendee, extender)
2507
- selector = parse_selector(selector, :selector)
2508
- extendee = parse_selector(extendee, :extendee)
2509
- extender = parse_selector(extender, :extender)
2510
-
2511
- extends = Sass::Util::SubsetMap.new
2512
- begin
2513
- extender.populate_extends(extends, extendee, nil, [], true)
2514
- selector.do_extend(extends).to_sass_script
2515
- rescue Sass::SyntaxError => e
2516
- raise ArgumentError.new(e.to_s)
2517
- end
2518
- end
2519
- declare :selector_extend, [:selector, :extendee, :extender]
2520
-
2521
- # Replaces all instances of `$original` with `$replacement` in `$selector`
2522
- #
2523
- # This works by using `@extend` and throwing away the original
2524
- # selector. This means that it can be used to do very advanced
2525
- # replacements; see the examples below.
2526
- #
2527
- # @example
2528
- # selector-replace(".foo .bar", ".bar", ".baz") => ".foo .baz"
2529
- # selector-replace(".foo.bar.baz", ".foo.baz", ".qux") => ".bar.qux"
2530
- #
2531
- # @overload selector_replace($selector, $original, $replacement)
2532
- # @param $selector [Sass::Script::Value::String, Sass::Script::Value::List]
2533
- # The selector within which `$original` is replaced with
2534
- # `$replacement`. This can be either a string, a list of
2535
- # strings, or a list of lists of strings as returned by `&`.
2536
- # @param $original [Sass::Script::Value::String, Sass::Script::Value::List]
2537
- # The selector being replaced. This can be either a string, a
2538
- # list of strings, or a list of lists of strings as returned
2539
- # by `&`.
2540
- # @param $replacement [Sass::Script::Value::String, Sass::Script::Value::List]
2541
- # The selector that `$original` is being replaced with. This
2542
- # can be either a string, a list of strings, or a list of
2543
- # lists of strings as returned by `&`.
2544
- # @return [Sass::Script::Value::List]
2545
- # A list of lists of strings representing the result of the
2546
- # extension. This is in the same format as a selector returned
2547
- # by `&`.
2548
- # @raise [ArgumentError] if the replacement fails
2549
- def selector_replace(selector, original, replacement)
2550
- selector = parse_selector(selector, :selector)
2551
- original = parse_selector(original, :original)
2552
- replacement = parse_selector(replacement, :replacement)
2553
-
2554
- extends = Sass::Util::SubsetMap.new
2555
- begin
2556
- replacement.populate_extends(extends, original, nil, [], true)
2557
- selector.do_extend(extends, [], true).to_sass_script
2558
- rescue Sass::SyntaxError => e
2559
- raise ArgumentError.new(e.to_s)
2560
- end
2561
- end
2562
- declare :selector_replace, [:selector, :original, :replacement]
2563
-
2564
- # Unifies two selectors into a single selector that matches only
2565
- # elements matched by both input selectors. Returns `null` if
2566
- # there is no such selector.
2567
- #
2568
- # Like the selector unification done for `@extend`, this doesn't
2569
- # guarantee that the output selector will match *all* elements
2570
- # matched by both input selectors. For example, if `.a .b` is
2571
- # unified with `.x .y`, `.a .x .b.y, .x .a .b.y` will be returned,
2572
- # but `.a.x .b.y` will not. This avoids exponential output size
2573
- # while matching all elements that are likely to exist in
2574
- # practice.
2575
- #
2576
- # @example
2577
- # selector-unify(".a", ".b") => .a.b
2578
- # selector-unify(".a .b", ".x .y") => .a .x .b.y, .x .a .b.y
2579
- # selector-unify(".a.b", ".b.c") => .a.b.c
2580
- # selector-unify("#a", "#b") => null
2581
- #
2582
- # @overload selector_unify($selector1, $selector2)
2583
- # @param $selector1 [Sass::Script::Value::String, Sass::Script::Value::List]
2584
- # The first selector to be unified. This can be either a
2585
- # string, a list of strings, or a list of lists of strings as
2586
- # returned by `&`.
2587
- # @param $selector2 [Sass::Script::Value::String, Sass::Script::Value::List]
2588
- # The second selector to be unified. This can be either a
2589
- # string, a list of strings, or a list of lists of strings as
2590
- # returned by `&`.
2591
- # @return [Sass::Script::Value::List, Sass::Script::Value::Null]
2592
- # A list of lists of strings representing the result of the
2593
- # unification, or null if no unification exists. This is in
2594
- # the same format as a selector returned by `&`.
2595
- def selector_unify(selector1, selector2)
2596
- selector1 = parse_selector(selector1, :selector1)
2597
- selector2 = parse_selector(selector2, :selector2)
2598
- return null unless (unified = selector1.unify(selector2))
2599
- unified.to_sass_script
2600
- end
2601
- declare :selector_unify, [:selector1, :selector2]
2602
-
2603
- # Returns the [simple
2604
- # selectors](http://dev.w3.org/csswg/selectors4/#simple) that
2605
- # comprise the compound selector `$selector`.
2606
- #
2607
- # Note that `$selector` **must be** a [compound
2608
- # selector](http://dev.w3.org/csswg/selectors4/#compound). That
2609
- # means it cannot contain commas or spaces. It also means that
2610
- # unlike other selector functions, this takes only strings, not
2611
- # lists.
2612
- #
2613
- # @example
2614
- # simple-selectors(".foo.bar") => ".foo", ".bar"
2615
- # simple-selectors(".foo.bar.baz") => ".foo", ".bar", ".baz"
2616
- #
2617
- # @overload simple_selectors($selector)
2618
- # @param $selector [Sass::Script::Value::String]
2619
- # The compound selector whose simple selectors will be extracted.
2620
- # @return [Sass::Script::Value::List]
2621
- # A list of simple selectors in the compound selector.
2622
- def simple_selectors(selector)
2623
- selector = parse_compound_selector(selector, :selector)
2624
- list(selector.members.map {|simple| unquoted_string(simple.to_s)}, :comma)
2625
- end
2626
- declare :simple_selectors, [:selector]
2627
-
2628
- # Returns whether `$super` is a superselector of `$sub`. This means that
2629
- # `$super` matches all the elements that `$sub` matches, as well as possibly
2630
- # additional elements. In general, simpler selectors tend to be
2631
- # superselectors of more complex oned.
2632
- #
2633
- # @example
2634
- # is-superselector(".foo", ".foo.bar") => true
2635
- # is-superselector(".foo.bar", ".foo") => false
2636
- # is-superselector(".bar", ".foo .bar") => true
2637
- # is-superselector(".foo .bar", ".bar") => false
2638
- #
2639
- # @overload is_superselector($super, $sub)
2640
- # @param $super [Sass::Script::Value::String, Sass::Script::Value::List]
2641
- # The potential superselector. This can be either a string, a list of
2642
- # strings, or a list of lists of strings as returned by `&`.
2643
- # @param $sub [Sass::Script::Value::String, Sass::Script::Value::List]
2644
- # The potential subselector. This can be either a string, a list of
2645
- # strings, or a list of lists of strings as returned by `&`.
2646
- # @return [Sass::Script::Value::Bool]
2647
- # Whether `$selector1` is a superselector of `$selector2`.
2648
- def is_superselector(sup, sub)
2649
- sup = parse_selector(sup, :super)
2650
- sub = parse_selector(sub, :sub)
2651
- bool(sup.superselector?(sub))
2652
- end
2653
- declare :is_superselector, [:super, :sub]
2654
-
2655
- private
2656
-
2657
- # This method implements the pattern of transforming a numeric value into
2658
- # another numeric value with the same units.
2659
- # It yields a number to a block to perform the operation and return a number
2660
- def numeric_transformation(value)
2661
- assert_type value, :Number, :value
2662
- Sass::Script::Value::Number.new(
2663
- yield(value.value), value.numerator_units, value.denominator_units)
2664
- end
2665
-
2666
- # @comment
2667
- # rubocop:disable ParameterLists
2668
- def _adjust(color, amount, attr, range, op, units = "")
2669
- # rubocop:enable ParameterLists
2670
- assert_type color, :Color, :color
2671
- assert_type amount, :Number, :amount
2672
- Sass::Util.check_range('Amount', range, amount, units)
2673
-
2674
- color.with(attr => color.send(attr).send(op, amount.value))
2675
- end
2676
-
2677
- def check_alpha_unit(alpha, function)
2678
- return if alpha.unitless?
2679
-
2680
- if alpha.is_unit?("%")
2681
- Sass::Util.sass_warn(<<WARNING)
2682
- DEPRECATION WARNING: Passing a percentage as the alpha value to #{function}() will be
2683
- interpreted differently in future versions of Sass. For now, use #{alpha.value} instead.
2684
- WARNING
2685
- else
2686
- Sass::Util.sass_warn(<<WARNING)
2687
- DEPRECATION WARNING: Passing a number with units as the alpha value to #{function}() is
2688
- deprecated and will be an error in future versions of Sass. Use #{alpha.value} instead.
2689
- WARNING
2690
- end
2691
- end
2692
- end
2693
- end