brakeman 6.2.2 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +26 -0
- data/README.md +1 -1
- data/bundle/load.rb +10 -8
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/LICENSE.txt +33 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/NEWS.md +990 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/README.md +55 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/core_ext/array.rb +9 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/core_ext/string.rb +9 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/fields_converter.rb +96 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/input_record_separator.rb +18 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/parser.rb +1302 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/row.rb +757 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/table.rb +1055 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/version.rb +6 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv/writer.rb +209 -0
- data/bundle/ruby/3.1.0/gems/csv-3.3.3/lib/csv.rb +3017 -0
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/Changelog.md +4 -0
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/Gemfile +1 -0
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/list_renderer.rb +2 -2
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/menu.rb +7 -5
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/version.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline.rb +17 -12
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/config.rb +22 -26
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/history.rb +3 -3
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/io/ansi.rb +64 -111
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/io/dumb.rb +16 -2
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/io/windows.rb +77 -60
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/io.rb +14 -0
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/key_actor/base.rb +10 -4
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/key_actor/emacs.rb +96 -96
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/key_actor/vi_command.rb +182 -182
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/key_actor/vi_insert.rb +137 -137
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/key_stroke.rb +26 -16
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/line_editor.rb +238 -404
- data/bundle/ruby/3.1.0/gems/reline-0.6.0/lib/reline/unicode.rb +415 -0
- data/bundle/ruby/3.1.0/gems/reline-0.6.0/lib/reline/version.rb +3 -0
- data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline.rb +18 -18
- data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/NEWS.md +74 -0
- data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/baseparser.rb +78 -48
- data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/pullparser.rb +4 -0
- data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/rexml.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/source.rb +61 -6
- data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/text.rb +15 -40
- data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/History.rdoc +6 -0
- data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/lib/ruby2ruby.rb +7 -4
- data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/History.rdoc +6 -0
- data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/lib/sexp.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/3.1.0/gems/terminal-table-4.0.0/History.rdoc +149 -0
- data/bundle/ruby/3.1.0/gems/terminal-table-4.0.0/README.md +417 -0
- data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/lib/terminal-table/cell.rb +9 -9
- data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/lib/terminal-table/row.rb +18 -4
- data/bundle/ruby/3.1.0/gems/terminal-table-4.0.0/lib/terminal-table/separator.rb +66 -0
- data/bundle/ruby/3.1.0/gems/terminal-table-4.0.0/lib/terminal-table/style.rb +284 -0
- data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/lib/terminal-table/table.rb +49 -18
- data/bundle/ruby/3.1.0/gems/terminal-table-4.0.0/lib/terminal-table/util.rb +13 -0
- data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/lib/terminal-table/version.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/lib/terminal-table.rb +2 -2
- data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/terminal-table.gemspec +3 -4
- data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/creole.rb +2 -0
- data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/liquid.rb +0 -3
- data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/mapping.rb +3 -3
- data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/rdoc.rb +0 -8
- data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/template.rb +178 -27
- data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt.rb +9 -4
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/CHANGELOG.md +291 -0
- data/bundle/ruby/3.1.0/gems/{unicode-display_width-1.8.0 → unicode-display_width-3.1.4}/MIT-LICENSE.txt +1 -1
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/README.md +194 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/constants.rb +10 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/emoji_support.rb +52 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/index.rb +34 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/no_string_ext.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/reline_ext.rb +14 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/string_ext.rb +9 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width.rb +247 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/CHANGELOG.md +191 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/CODE_OF_CONDUCT.md +74 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/Gemfile +7 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/Gemfile.lock +33 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/MIT-LICENSE.txt +20 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/README.md +205 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/data/emoji.marshal.gz +0 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/data/generate_constants.rb +344 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/constants.rb +49 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_basic.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_emoji_keycap.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_include_mqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_include_mqe_uqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_picto.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_picto_no_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_possible.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_component.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_modifier.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_modifier_base.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_text_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_valid.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_valid_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_well_formed.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_well_formed_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_basic.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_emoji_keycap.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_include_mqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_include_mqe_uqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_picto.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_picto_no_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_possible.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_component.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_modifier.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_modifier_base.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_text_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_valid.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_valid_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_well_formed.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_well_formed_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/{unicode-display_width-1.8.0/lib/unicode/display_width → unicode-emoji-4.0.4/lib/unicode/emoji}/index.rb +5 -3
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/lazy_constants.rb +56 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/list.rb +13 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji.rb +111 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/unicode-emoji.gemspec +22 -0
- data/lib/brakeman/app_tree.rb +29 -19
- data/lib/brakeman/checks/check_deserialize.rb +4 -1
- data/lib/brakeman/checks/check_evaluation.rb +45 -8
- data/lib/brakeman/checks/check_model_attr_accessible.rb +1 -0
- data/lib/brakeman/checks/check_weak_rsa_key.rb +1 -1
- data/lib/brakeman/file_parser.rb +2 -1
- data/lib/brakeman/options.rb +12 -5
- data/lib/brakeman/processors/alias_processor.rb +9 -4
- data/lib/brakeman/processors/lib/file_type_detector.rb +9 -7
- data/lib/brakeman/report/ignore/config.rb +0 -1
- data/lib/brakeman/report/report_sarif.rb +122 -2
- data/lib/brakeman/rescanner.rb +40 -390
- data/lib/brakeman/scanner.rb +84 -51
- data/lib/brakeman/tracker/file_cache.rb +83 -0
- data/lib/brakeman/tracker.rb +19 -2
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman.rb +19 -2
- metadata +265 -199
- data/bundle/ruby/3.1.0/gems/reline-0.5.10/lib/reline/terminfo.rb +0 -158
- data/bundle/ruby/3.1.0/gems/reline-0.5.10/lib/reline/unicode.rb +0 -671
- data/bundle/ruby/3.1.0/gems/reline-0.5.10/lib/reline/version.rb +0 -3
- data/bundle/ruby/3.1.0/gems/terminal-table-1.8.0/History.rdoc +0 -85
- data/bundle/ruby/3.1.0/gems/terminal-table-1.8.0/README.rdoc +0 -247
- data/bundle/ruby/3.1.0/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb +0 -14
- data/bundle/ruby/3.1.0/gems/terminal-table-1.8.0/lib/terminal-table/style.rb +0 -79
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/erubis.rb +0 -51
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/maruku.rb +0 -10
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/wikicloth.rb +0 -12
- data/bundle/ruby/3.1.0/gems/unicode-display_width-1.8.0/CHANGELOG.md +0 -137
- data/bundle/ruby/3.1.0/gems/unicode-display_width-1.8.0/README.md +0 -124
- data/bundle/ruby/3.1.0/gems/unicode-display_width-1.8.0/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-1.8.0/lib/unicode/display_width/constants.rb +0 -8
- data/bundle/ruby/3.1.0/gems/unicode-display_width-1.8.0/lib/unicode/display_width/no_string_ext.rb +0 -7
- data/bundle/ruby/3.1.0/gems/unicode-display_width-1.8.0/lib/unicode/display_width/string_ext.rb +0 -17
- data/bundle/ruby/3.1.0/gems/unicode-display_width-1.8.0/lib/unicode/display_width.rb +0 -51
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/AUTHORS +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/COPYING +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/LICENSE +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/README.md +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/TODO +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/highline.gemspec +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/builtin_styles.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/color_scheme.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/compatibility.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/custom_errors.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/import.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/io_console_compatible.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/list.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/menu/item.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/paginator.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/question/answer_converter.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/question.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/question_asker.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/simulate.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/statement.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/string.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/string_extensions.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/style.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/template_renderer.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal/io_console.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal/ncurses.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal/unix_stty.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/wrapper.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/BSDL +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/COPYING +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/README.md +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/face.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/key_actor/composite.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/key_actor.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/kill_ring.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/lib/reline/unicode/east_asian_width.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{reline-0.5.10 → reline-0.6.0}/license_of_rb-readline +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/LICENSE.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/README.md +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/attlistdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/attribute.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/cdata.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/child.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/comment.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/doctype.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/document.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/dtd/attlistdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/dtd/dtd.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/dtd/elementdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/dtd/entitydecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/dtd/notationdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/element.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/encoding.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/entity.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/formatters/default.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/formatters/pretty.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/formatters/transitive.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/functions.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/instruction.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/light/node.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/namespace.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/node.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/output.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parent.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parseexception.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/lightparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/sax2parser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/streamparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/treeparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/ultralightparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/parsers/xpathparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/quickpath.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/sax2listener.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/security.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/streamlistener.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/undefinednamespaceexception.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/validation/relaxng.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/validation/validation.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/validation/validationexception.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/xmldecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/xmltokens.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/xpath.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml/xpath_parser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.3.8 → rexml-3.4.1}/lib/rexml.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/Manifest.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/README.rdoc +0 -0
- /data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/Manifest.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/README.rdoc +0 -0
- /data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/lib/composite_sexp_processor.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/lib/pt_testcase.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/lib/sexp_matcher.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/lib/strict_sexp.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{sexp_processor-4.17.2 → sexp_processor-4.17.3}/lib/unique.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/Gemfile +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/LICENSE.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/Manifest +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/Todo.rdoc +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/lib/terminal-table/import.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-1.8.0 → terminal-table-4.0.0}/lib/terminal-table/table_helper.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/COPYING +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/_emacs_org.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/_handlebars.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/_jbuilder.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/_org.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/asciidoc.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/babel.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/builder.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/cli.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/coffee.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/commonmarker.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/csv.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/erb.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/erubi.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/etanni.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/haml.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/kramdown.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/livescript.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/markaby.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/nokogiri.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/pandoc.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/pipeline.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/plain.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/prawn.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/radius.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/rdiscount.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/redcarpet.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/redcloth.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/rst-pandoc.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/sass.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/slim.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/string.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/typescript.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.4.0 → tilt-2.6.0}/lib/tilt/yajl.rb +0 -0
@@ -57,7 +57,28 @@ module Tilt
|
|
57
57
|
# it should read template data and return as a String. When file is nil,
|
58
58
|
# a block is required.
|
59
59
|
#
|
60
|
-
# All arguments are optional.
|
60
|
+
# All arguments are optional. The following options are respected and
|
61
|
+
# are used by Tilt::Template itself and not the underlying template
|
62
|
+
# libraries:
|
63
|
+
#
|
64
|
+
# :default_encoding :: Force the encoding of the template to the given
|
65
|
+
# encoding.
|
66
|
+
# :skip_compiled_encoding_detection :: Do not scan template code for
|
67
|
+
# an encoding magic comment.
|
68
|
+
# :fixed_locals :: Force a specific method parameter signature, and call
|
69
|
+
# the method with a splat of locals, instead of passing
|
70
|
+
# the locals hash as a positional argument, and
|
71
|
+
# extracting locals from that. Should be a string
|
72
|
+
# containing the parameters for the compiled method,
|
73
|
+
# surrounded by parentheses. Can be set to false to
|
74
|
+
# disable the scan for embedded fixed locals.
|
75
|
+
# :extract_fixed_locals :: Whether embedded fixed locals should be scanned for
|
76
|
+
# and extracted from the template code.
|
77
|
+
# :default_fixed_locals :: Similar to fixed_locals, but lowest priority,
|
78
|
+
# only used if :fixed_locals is not provided
|
79
|
+
# and no embedded locals are found (or scanned for).
|
80
|
+
# :scope_class :: Force the scope class used for the method. By default,
|
81
|
+
# uses the class of the scope provided to render.
|
61
82
|
def initialize(file=nil, line=nil, options=nil)
|
62
83
|
@file, @line, @options = nil, 1, nil
|
63
84
|
|
@@ -69,7 +90,9 @@ module Tilt
|
|
69
90
|
|
70
91
|
@options ||= {}
|
71
92
|
|
72
|
-
|
93
|
+
# Force a specific scope class, instead of using the class of the provided
|
94
|
+
# scope as the scope class.
|
95
|
+
@scope_class = @options.delete :scope_class
|
73
96
|
|
74
97
|
# Force the encoding of the input data
|
75
98
|
@default_encoding = @options.delete :default_encoding
|
@@ -78,12 +101,19 @@ module Tilt
|
|
78
101
|
# for compiled templates
|
79
102
|
@skip_compiled_encoding_detection = @options.delete :skip_compiled_encoding_detection
|
80
103
|
|
104
|
+
# Compiled path to use. This must be specified as an option if
|
105
|
+
# providing the :scope_class option and using fixed locals,
|
106
|
+
# since template compilation occurs during initialization in that case.
|
107
|
+
if compiled_path = @options.delete(:compiled_path)
|
108
|
+
self.compiled_path = compiled_path
|
109
|
+
end
|
110
|
+
|
81
111
|
# load template data and prepare (uses binread to avoid encoding issues)
|
82
112
|
@data = block_given? ? yield(self) : read_template_file
|
83
113
|
|
84
114
|
if @data.respond_to?(:force_encoding)
|
85
115
|
if default_encoding
|
86
|
-
@data = @data
|
116
|
+
@data = _dup_string_if_frozen(@data)
|
87
117
|
@data.force_encoding(default_encoding)
|
88
118
|
end
|
89
119
|
|
@@ -92,7 +122,9 @@ module Tilt
|
|
92
122
|
end
|
93
123
|
end
|
94
124
|
|
125
|
+
set_fixed_locals
|
95
126
|
prepare
|
127
|
+
set_compiled_method_cache
|
96
128
|
end
|
97
129
|
|
98
130
|
# Render the template in the given scope with the locals specified. If a
|
@@ -119,6 +151,11 @@ module Tilt
|
|
119
151
|
@file || '(__TEMPLATE__)'
|
120
152
|
end
|
121
153
|
|
154
|
+
# Whether the template uses fixed locals.
|
155
|
+
def fixed_locals?
|
156
|
+
@fixed_locals ? true : false
|
157
|
+
end
|
158
|
+
|
122
159
|
# An empty Hash that the template engine can populate with various
|
123
160
|
# metadata.
|
124
161
|
def metadata
|
@@ -129,7 +166,14 @@ module Tilt
|
|
129
166
|
end
|
130
167
|
end
|
131
168
|
|
132
|
-
# Set the prefix to use for compiled paths
|
169
|
+
# Set the prefix to use for compiled paths, similar to using the
|
170
|
+
# :compiled_path template option. Note that this only
|
171
|
+
# has affect for future template compilations. When using the
|
172
|
+
# :scope_class template option, and using fixed_locals, calling
|
173
|
+
# this after the template is created has no effect, since the
|
174
|
+
# template is compiled during initialization in that case. It
|
175
|
+
# is recommended to use the :compiled_path template option
|
176
|
+
# instead of this method in new code.
|
133
177
|
def compiled_path=(path)
|
134
178
|
if path
|
135
179
|
# Use expanded paths when loading, since that is helpful
|
@@ -145,7 +189,18 @@ module Tilt
|
|
145
189
|
# directly on the scope class, which are much faster to call than
|
146
190
|
# Tilt's normal rendering.
|
147
191
|
def compiled_method(locals_keys, scope_class=nil)
|
148
|
-
|
192
|
+
if @fixed_locals
|
193
|
+
if @scope_class
|
194
|
+
return @compiled_method
|
195
|
+
else
|
196
|
+
key = scope_class
|
197
|
+
end
|
198
|
+
elsif @scope_class
|
199
|
+
key = locals_keys.dup.freeze
|
200
|
+
else
|
201
|
+
key = [scope_class, locals_keys].freeze
|
202
|
+
end
|
203
|
+
|
149
204
|
LOCK.synchronize do
|
150
205
|
if meth = @compiled_method[key]
|
151
206
|
return meth
|
@@ -181,7 +236,7 @@ module Tilt
|
|
181
236
|
end
|
182
237
|
|
183
238
|
CLASS_METHOD = Kernel.instance_method(:class)
|
184
|
-
USE_BIND_CALL = RUBY_VERSION >= '
|
239
|
+
USE_BIND_CALL = RUBY_VERSION >= '3'
|
185
240
|
|
186
241
|
# Execute the compiled template and return the result string. Template
|
187
242
|
# evaluation is guaranteed to be performed in the scope object with the
|
@@ -190,26 +245,25 @@ module Tilt
|
|
190
245
|
# This method is only used by source generating templates. Subclasses that
|
191
246
|
# override render() may not support all features.
|
192
247
|
def evaluate(scope, locals, &block)
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
case scope
|
197
|
-
when Object
|
198
|
-
scope_class = Module === scope ? scope : scope.class
|
248
|
+
if @fixed_locals
|
249
|
+
locals_keys = EMPTY_ARRAY
|
199
250
|
else
|
200
|
-
|
201
|
-
|
202
|
-
# :nocov:
|
251
|
+
locals_keys = locals.keys
|
252
|
+
locals_keys.sort!{|x, y| x.to_s <=> y.to_s}
|
203
253
|
end
|
204
|
-
method = compiled_method(locals_keys, scope_class)
|
205
254
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
255
|
+
unless scope_class = @scope_class
|
256
|
+
scope_class = case scope
|
257
|
+
when Object
|
258
|
+
Module === scope ? scope : scope.class
|
259
|
+
else
|
260
|
+
# :nocov:
|
261
|
+
USE_BIND_CALL ? CLASS_METHOD.bind_call(scope) : CLASS_METHOD.bind(scope).call
|
262
|
+
# :nocov:
|
263
|
+
end
|
212
264
|
end
|
265
|
+
|
266
|
+
evaluate_method(compiled_method(locals_keys, scope_class), scope, locals, &block)
|
213
267
|
end
|
214
268
|
|
215
269
|
# Generates all template source by combining the preamble, template, and
|
@@ -267,6 +321,18 @@ module Tilt
|
|
267
321
|
|
268
322
|
private
|
269
323
|
|
324
|
+
if RUBY_VERSION >= '2.3'
|
325
|
+
def _dup_string_if_frozen(string)
|
326
|
+
+string
|
327
|
+
end
|
328
|
+
# :nocov:
|
329
|
+
else
|
330
|
+
def _dup_string_if_frozen(string)
|
331
|
+
string.frozen? ? string.dup : string
|
332
|
+
end
|
333
|
+
end
|
334
|
+
# :nocov:
|
335
|
+
|
270
336
|
def process_arg(arg)
|
271
337
|
if arg
|
272
338
|
case
|
@@ -291,7 +357,12 @@ module Tilt
|
|
291
357
|
end
|
292
358
|
|
293
359
|
def set_compiled_method_cache
|
294
|
-
@compiled_method =
|
360
|
+
@compiled_method = if @fixed_locals && @scope_class
|
361
|
+
# No hash needed, only a single compiled method per template.
|
362
|
+
compile_template_method(EMPTY_ARRAY, @scope_class)
|
363
|
+
else
|
364
|
+
{}
|
365
|
+
end
|
295
366
|
end
|
296
367
|
|
297
368
|
def local_extraction(local_keys)
|
@@ -315,9 +386,39 @@ module Tilt
|
|
315
386
|
assignments.join("\n")
|
316
387
|
end
|
317
388
|
|
389
|
+
if USE_BIND_CALL
|
390
|
+
def evaluate_method(method, scope, locals, &block)
|
391
|
+
if @fixed_locals
|
392
|
+
method.bind_call(scope, **locals, &block)
|
393
|
+
else
|
394
|
+
method.bind_call(scope, locals, &block)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
# :nocov:
|
398
|
+
else
|
399
|
+
def evaluate_method(method, scope, locals, &block)
|
400
|
+
if @fixed_locals
|
401
|
+
if locals.empty?
|
402
|
+
# Empty keyword splat on Ruby 2.0-2.6 passes empty hash
|
403
|
+
method.bind(scope).call(&block)
|
404
|
+
else
|
405
|
+
method.bind(scope).call(**locals, &block)
|
406
|
+
end
|
407
|
+
else
|
408
|
+
method.bind(scope).call(locals, &block)
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
# :nocov:
|
413
|
+
|
318
414
|
def compile_template_method(local_keys, scope_class=nil)
|
319
415
|
source, offset = precompiled(local_keys)
|
320
|
-
|
416
|
+
if @fixed_locals
|
417
|
+
method_args = @fixed_locals
|
418
|
+
else
|
419
|
+
method_args = "(locals)"
|
420
|
+
local_code = local_extraction(local_keys)
|
421
|
+
end
|
321
422
|
|
322
423
|
method_name = "__tilt_#{Thread.current.object_id.abs}"
|
323
424
|
method_source = String.new
|
@@ -328,7 +429,7 @@ module Tilt
|
|
328
429
|
end
|
329
430
|
|
330
431
|
# Don't indent method source, to avoid indentation warnings when using compiled paths
|
331
|
-
method_source << "::Tilt::TOPOBJECT.class_eval do\ndef #{method_name}
|
432
|
+
method_source << "::Tilt::TOPOBJECT.class_eval do\ndef #{method_name}#{method_args}\n#{local_code}\n"
|
332
433
|
|
333
434
|
offset += method_source.count("\n")
|
334
435
|
method_source << source
|
@@ -385,13 +486,49 @@ module Tilt
|
|
385
486
|
method
|
386
487
|
end
|
387
488
|
|
489
|
+
# Set the fixed locals for the template, which may be nil if no fixed locals can
|
490
|
+
# be determined.
|
491
|
+
def set_fixed_locals
|
492
|
+
fixed_locals = @options.delete(:fixed_locals)
|
493
|
+
extract_fixed_locals = @options.delete(:extract_fixed_locals)
|
494
|
+
default_fixed_locals = @options.delete(:default_fixed_locals)
|
495
|
+
|
496
|
+
if fixed_locals.nil?
|
497
|
+
if extract_fixed_locals.nil?
|
498
|
+
extract_fixed_locals = Tilt.extract_fixed_locals
|
499
|
+
end
|
500
|
+
|
501
|
+
if extract_fixed_locals
|
502
|
+
fixed_locals = extract_fixed_locals()
|
503
|
+
end
|
504
|
+
|
505
|
+
if fixed_locals.nil?
|
506
|
+
fixed_locals = default_fixed_locals
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
@fixed_locals = fixed_locals
|
511
|
+
end
|
512
|
+
|
513
|
+
# Extract fixed locals from the template code string. Should return nil
|
514
|
+
# if there are no fixed locals specified, or a method argument string
|
515
|
+
# surrounded by parentheses if there are fixed locals. The method
|
516
|
+
# argument string will be used when defining the template method if given.
|
517
|
+
def extract_fixed_locals
|
518
|
+
if @data.is_a?(String) && (match = /\#\s*locals:\s*(\(.*\))/.match(@data))
|
519
|
+
match[1]
|
520
|
+
end
|
521
|
+
end
|
522
|
+
|
388
523
|
def extract_encoding(script, &block)
|
389
524
|
extract_magic_comment(script, &block) || script.encoding
|
390
525
|
end
|
391
526
|
|
392
527
|
def extract_magic_comment(script)
|
393
|
-
|
394
|
-
|
528
|
+
was_frozen = script.frozen?
|
529
|
+
script = _dup_string_if_frozen(script)
|
530
|
+
|
531
|
+
if was_frozen
|
395
532
|
yield script
|
396
533
|
end
|
397
534
|
|
@@ -413,6 +550,16 @@ module Tilt
|
|
413
550
|
end
|
414
551
|
end
|
415
552
|
|
553
|
+
# Static templates are templates that return the same output for every render
|
554
|
+
#
|
555
|
+
# Instead of inheriting from the StaticTemplate class, you will use the .subclass
|
556
|
+
# method with a block which processes @data and returns the transformed value.
|
557
|
+
#
|
558
|
+
# Basic example which transforms the template to uppercase:
|
559
|
+
#
|
560
|
+
# UppercaseTemplate = Tilt::StaticTemplate.subclass do
|
561
|
+
# @data.upcase
|
562
|
+
# end
|
416
563
|
class StaticTemplate < Template
|
417
564
|
def self.subclass(mime_type: 'text/html', &block)
|
418
565
|
Class.new(self) do
|
@@ -451,5 +598,9 @@ module Tilt
|
|
451
598
|
# Do nothing, since compiled method cache is not used.
|
452
599
|
def set_compiled_method_cache
|
453
600
|
end
|
601
|
+
|
602
|
+
# Do nothing, since fixed locals are not used.
|
603
|
+
def set_fixed_locals
|
604
|
+
end
|
454
605
|
end
|
455
606
|
end
|
@@ -5,12 +5,16 @@ require_relative 'tilt/template'
|
|
5
5
|
# Namespace for Tilt. This module is not intended to be included anywhere.
|
6
6
|
module Tilt
|
7
7
|
# Current version.
|
8
|
-
VERSION = '2.
|
8
|
+
VERSION = '2.6.0'
|
9
|
+
|
10
|
+
EMPTY_ARRAY = [].freeze
|
11
|
+
private_constant :EMPTY_ARRAY
|
9
12
|
|
10
13
|
EMPTY_HASH = {}.freeze
|
11
14
|
private_constant :EMPTY_HASH
|
12
15
|
|
13
16
|
@default_mapping = Mapping.new
|
17
|
+
@extract_fixed_locals = false
|
14
18
|
|
15
19
|
# Replace the default mapping with a finalized version of the default
|
16
20
|
# mapping. This can be done to improve performance after the template
|
@@ -86,6 +90,10 @@ module Tilt
|
|
86
90
|
# @return [Tilt::Mapping] the main mapping object
|
87
91
|
attr_reader :default_mapping
|
88
92
|
|
93
|
+
# Whether to extract fixed locals from templates by scanning the
|
94
|
+
# template content.
|
95
|
+
attr_accessor :extract_fixed_locals
|
96
|
+
|
89
97
|
# Alias register as prefer for Tilt 1.x compatibility.
|
90
98
|
alias prefer register
|
91
99
|
end
|
@@ -139,11 +147,9 @@ module Tilt
|
|
139
147
|
|
140
148
|
# ERB
|
141
149
|
register_lazy :ERBTemplate, 'tilt/erb', 'erb', 'rhtml'
|
142
|
-
register_lazy :ErubisTemplate, 'tilt/erubis', 'erb', 'rhtml', 'erubis'
|
143
150
|
register_lazy :ErubiTemplate, 'tilt/erubi', 'erb', 'rhtml', 'erubi'
|
144
151
|
|
145
152
|
# Markdown
|
146
|
-
register_lazy :MarukuTemplate, 'tilt/maruku', 'markdown', 'mkd', 'md'
|
147
153
|
register_lazy :KramdownTemplate, 'tilt/kramdown', 'markdown', 'mkd', 'md'
|
148
154
|
register_lazy :RDiscountTemplate, 'tilt/rdiscount', 'markdown', 'mkd', 'md'
|
149
155
|
register_lazy :RedcarpetTemplate, 'tilt/redcarpet', 'markdown', 'mkd', 'md'
|
@@ -175,7 +181,6 @@ module Tilt
|
|
175
181
|
register_lazy :SlimTemplate, 'tilt/slim', 'slim'
|
176
182
|
register_lazy :StringTemplate, 'tilt/string', 'str'
|
177
183
|
register_lazy :TypeScriptTemplate, 'tilt/typescript', 'ts', 'tsx'
|
178
|
-
register_lazy :WikiClothTemplate, 'tilt/wikicloth', 'wiki', 'mediawiki', 'mw'
|
179
184
|
register_lazy :YajlTemplate, 'tilt/yajl', 'yajl'
|
180
185
|
|
181
186
|
# TILT3: Remove
|
@@ -0,0 +1,291 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 3.1.4
|
4
|
+
|
5
|
+
- Fix that skin tone modifiers were ignored when used in a non-ZWJ sequence
|
6
|
+
context (= single emoji char + modifier) #29
|
7
|
+
- Add more docs and specs about modifier handling
|
8
|
+
|
9
|
+
## 3.1.3
|
10
|
+
|
11
|
+
Better handling of non-UTF-8 strings, patch by @Earlopain:
|
12
|
+
|
13
|
+
- Data with *BINARY* encoding is interpreted as UTF-8, if possible
|
14
|
+
- Use `invalid: :replace` and `undef: :replace` options when converting to UTF-8
|
15
|
+
|
16
|
+
## 3.1.2
|
17
|
+
|
18
|
+
- Performance improvements
|
19
|
+
|
20
|
+
## 3.1.1
|
21
|
+
|
22
|
+
- Performance improvements
|
23
|
+
|
24
|
+
## 3.1.0
|
25
|
+
|
26
|
+
**Improve Emoji support:**
|
27
|
+
|
28
|
+
- Emoji modes: Differentiate between well-formed Emoji (`:possible`) and any
|
29
|
+
ZWJ/modifier sequence (`:all`). The latter is more common and more efficient
|
30
|
+
to implement.
|
31
|
+
- Unify `:rgi_{fqe,mqe,uqe}` options to just `:rgi` to keep things simpler (corresponds to
|
32
|
+
the former `:rgi_uqe` option). Most terminals that want to support the RGI set
|
33
|
+
will probably want to catch Emoji sequences with missing VS16s.
|
34
|
+
- Add new `:all_no_vs16` and `:rgi_at` modes to be able to support some terminals
|
35
|
+
that needs these quirks
|
36
|
+
- Add alias `emoji: :auto` for `emoji: true` and `emoji: :none` for `emoji: false`
|
37
|
+
- `:auto` mode: Only consider terminal cells when recommending Emoji support level
|
38
|
+
(Emoji themselves might display differently)
|
39
|
+
- `:auto` mode: Set default Emoji mode for unknown/unsupported terminals to `:none`
|
40
|
+
- Rename `:basic` mode to `:vs16`
|
41
|
+
|
42
|
+
## 3.0.1
|
43
|
+
|
44
|
+
|
45
|
+
- Add WezTerm and foot as good Emoji terminals
|
46
|
+
|
47
|
+
## 3.0.0
|
48
|
+
|
49
|
+
**Rework Emoji support:**
|
50
|
+
|
51
|
+
- Emoji widths are now enabled by default
|
52
|
+
- Only reduce Emoji width to 2 when RGI Emoji detected (configurable)
|
53
|
+
- VS16 turns Emoji characters of width 1 into full-width
|
54
|
+
- Please note that Emoji parsing has a notable impact on performance.
|
55
|
+
You can use the `emoji: false` option to disable Emoji adjustments
|
56
|
+
- Tries to detect terminal's Emoji support level automatically (from ENV vars)
|
57
|
+
|
58
|
+
**Index fixes and updates:**
|
59
|
+
|
60
|
+
- Private-use characters are considered ambiguous (were given width 1 before)
|
61
|
+
- Fix that a few zero-width ignorable codepoints from recent Unicode were missing
|
62
|
+
- Consider the following separators to be zero-width:
|
63
|
+
- U+2028 - LINE SEPARATOR - Zl
|
64
|
+
- U+2029 - PARAGRAPH SEPARATOR - Zp
|
65
|
+
|
66
|
+
**Other:**
|
67
|
+
|
68
|
+
- Add keyword arguments to `Unicode::DisplayWidth.of`. If you are using a hash
|
69
|
+
with overwrite values as third parameter, be sure to put it in curly braces.
|
70
|
+
- Using third parameter or explicit hash as fourth parameter is deprecated,
|
71
|
+
please migrate to the keyword arguments API
|
72
|
+
- Gem raises `ArgumentError` for ambiguous values other than 1 or 2
|
73
|
+
- Performance optimizations
|
74
|
+
- Require Ruby 2.5
|
75
|
+
|
76
|
+
## 2.6.0
|
77
|
+
|
78
|
+
- Unicode 16
|
79
|
+
|
80
|
+
## 2.5.0
|
81
|
+
|
82
|
+
- Unicode 15.1
|
83
|
+
|
84
|
+
## 2.4.2
|
85
|
+
|
86
|
+
More performance improvements:
|
87
|
+
|
88
|
+
- Optimize lookup of first 4096 codepoints
|
89
|
+
- Avoid overwrite lookup if no overwrites are set
|
90
|
+
|
91
|
+
## 2.4.1
|
92
|
+
|
93
|
+
- Improve general performance!
|
94
|
+
- Further improve performance for ASCII strings
|
95
|
+
|
96
|
+
*You should really upgrade - it's much faster now!*
|
97
|
+
|
98
|
+
## 2.4.0
|
99
|
+
- Improve performance for ASCII-only strings, by @fatkodima
|
100
|
+
- Require Ruby 2.4
|
101
|
+
|
102
|
+
## 2.3.0
|
103
|
+
|
104
|
+
- Unicode 15.0
|
105
|
+
|
106
|
+
## 2.2.0
|
107
|
+
|
108
|
+
- Add *Hangul Jamo Extended-B* block to zero-width chars, thanks @ninjalj #22
|
109
|
+
|
110
|
+
## 2.1.0
|
111
|
+
|
112
|
+
- Unicode 14.0
|
113
|
+
|
114
|
+
## 2.0.0
|
115
|
+
|
116
|
+
Add Support for Ruby 3.0
|
117
|
+
|
118
|
+
### Breaking Changes
|
119
|
+
|
120
|
+
Some features of this library were marked deprecated for a long time and have been removed with Version 2.0:
|
121
|
+
|
122
|
+
- Aliases of display\_width (…\_size, …\_length) have been removed
|
123
|
+
- Auto-loading of string core extension has been removed:
|
124
|
+
|
125
|
+
If you are relying on the `String#display_width` string extension to be automatically loaded (old behavior), please load it explicitly now:
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
require "unicode/display_width/string_ext"
|
129
|
+
```
|
130
|
+
|
131
|
+
You could also change your `Gemfile` line to achieve this:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
gem "unicode-display_width", require: "unicode/display_width/string_ext"
|
135
|
+
```
|
136
|
+
|
137
|
+
## 2.0.0.pre2
|
138
|
+
|
139
|
+
- Update 2.0 branch to Unicode 13
|
140
|
+
|
141
|
+
## 2.0.0.pre1
|
142
|
+
|
143
|
+
Will be published as non-pre version on rubygems.org when Ruby 3.0 is released (December 2020)
|
144
|
+
|
145
|
+
- Introduce new class-based API, which remembers your string-width configuration. See README for details.
|
146
|
+
- Remove auto-loading of string extension
|
147
|
+
- You can: `require "unicode/display_width/string_ext"` to continue to use the string extension
|
148
|
+
- The manual opt-out `require "unicode/display_width/no_string_ext"` is not needed anymore and will
|
149
|
+
issue a warning in the future
|
150
|
+
- Remove (already deprecated) String#display_size and String#display_width aliases
|
151
|
+
|
152
|
+
Refactorings / Internal Changes:
|
153
|
+
|
154
|
+
- Freeze string literals
|
155
|
+
- The Unicode::DisplayWidth now is class, instead of a module, this enables the new config-object API
|
156
|
+
|
157
|
+
## 1.8.0
|
158
|
+
|
159
|
+
- Unicode 14.0 (last release of 1.x)
|
160
|
+
|
161
|
+
## 1.7.0
|
162
|
+
|
163
|
+
- Unicode 13
|
164
|
+
|
165
|
+
## 1.6.1
|
166
|
+
|
167
|
+
- Fix that ambiguous and overwrite options where ignored for emoji-measuring
|
168
|
+
|
169
|
+
## 1.6.0
|
170
|
+
|
171
|
+
- Unicode 12.1
|
172
|
+
|
173
|
+
## 1.5.0
|
174
|
+
|
175
|
+
- Unicode 12
|
176
|
+
|
177
|
+
## 1.4.1
|
178
|
+
|
179
|
+
- Only bundle required lib/* and data/* files in actual rubygem, patch by @tas50
|
180
|
+
|
181
|
+
## 1.4.0
|
182
|
+
|
183
|
+
- Unicode 11
|
184
|
+
|
185
|
+
## 1.3.3
|
186
|
+
|
187
|
+
- Replace Gem::Util.gunzip with direct zlib implementation
|
188
|
+
This removes the dependency on rubygems, fixes #17
|
189
|
+
|
190
|
+
## 1.3.2
|
191
|
+
|
192
|
+
- Explicitly load rubygems/util, fixes regression in 1.3.1 (autoload issue)
|
193
|
+
|
194
|
+
## 1.3.1
|
195
|
+
|
196
|
+
- Use `Gem::Util` for `gunzip`, removes deprecation warning, patch by @Schwad
|
197
|
+
|
198
|
+
## 1.3.0
|
199
|
+
|
200
|
+
- Unicode 10
|
201
|
+
|
202
|
+
## 1.2.1
|
203
|
+
|
204
|
+
- Fix bug that `emoji: true` would fail for emoji without modifier
|
205
|
+
|
206
|
+
## 1.2.0
|
207
|
+
|
208
|
+
- Add zero-width codepoint ranges: U+2060..U+206F, U+FFF0..U+FFF8, U+E0000..U+E0FFF
|
209
|
+
- Add full-witdh codepoint ranges: U+3400..U+4DBF, U+4E00..U+9FFF, U+F900..U+FAFF, U+20000..U+2FFFD, U+30000..U+3FFFD
|
210
|
+
- Experimental emoji support using the [unicode-emoji](https://github.com/janlelis/unicode-emoji) gem
|
211
|
+
- Fix minor bug in index compression scheme
|
212
|
+
|
213
|
+
## 1.1.3
|
214
|
+
|
215
|
+
- Fix that non-UTF-8 encodings do not throw errors, patch by @windwiny
|
216
|
+
|
217
|
+
## 1.1.2
|
218
|
+
|
219
|
+
- Reduce memory consumption and increase performance, patch by @rrosenblum
|
220
|
+
|
221
|
+
## 1.1.1
|
222
|
+
|
223
|
+
- Always load index into memory, fixes #9
|
224
|
+
|
225
|
+
## 1.1.0
|
226
|
+
|
227
|
+
- Support Unicode 9.0
|
228
|
+
|
229
|
+
## 1.0.5
|
230
|
+
|
231
|
+
- Actually include new index from 1.0.4
|
232
|
+
|
233
|
+
## 1.0.4
|
234
|
+
|
235
|
+
- New index format (much smaller) and internal API changes
|
236
|
+
- Move index generation to a builder plugin for the unicoder gem
|
237
|
+
- No public API changes
|
238
|
+
|
239
|
+
## 1.0.3
|
240
|
+
|
241
|
+
- Avoid circular dependency warning
|
242
|
+
|
243
|
+
## 1.0.2
|
244
|
+
|
245
|
+
- Fix error that gemspec might be invalid under some circumstances (see gh#6)
|
246
|
+
|
247
|
+
## 1.0.1
|
248
|
+
|
249
|
+
- Inofficially allow Ruby 1.9
|
250
|
+
|
251
|
+
## 1.0.0
|
252
|
+
|
253
|
+
- Faster than 0.3.1
|
254
|
+
- Advanced determination of character width
|
255
|
+
- This includes: Treat width of most chars of general categories (Mn, Me, Cf) as 0
|
256
|
+
- This includes: Introduce list of characters with special widths
|
257
|
+
- Allow custom overrides for specific codepoints
|
258
|
+
- Set required Ruby version to 2.0
|
259
|
+
- Add NO_STRING_EXT mode to disable monkey patching
|
260
|
+
- Internal API & index format changed drastically
|
261
|
+
- Remove require 'unicode/display_size' (use 'unicode/display_width' instead)
|
262
|
+
|
263
|
+
## 0.3.1
|
264
|
+
|
265
|
+
- Faster than 0.3.0
|
266
|
+
- Deprecate usage of aliases: String#display_size and String#display_length
|
267
|
+
- Eliminate Ruby warnings (@amatsuda)
|
268
|
+
|
269
|
+
## 0.3.0
|
270
|
+
|
271
|
+
- Update EastAsianWidth from 7.0 to 8.0
|
272
|
+
- Add rake task to update EastAsianWidth.txt
|
273
|
+
- Move code to generate index from library to Rakefile
|
274
|
+
- Update project's meta files
|
275
|
+
- Deprecate requiring 'unicode-display_size'
|
276
|
+
|
277
|
+
## 0.2.0
|
278
|
+
|
279
|
+
- Update EastAsianWidth from 6.0 to 7.0
|
280
|
+
- Don't build index table automatically when not available
|
281
|
+
- Don't include EastAsianWidth.txt in gem (only index)
|
282
|
+
|
283
|
+
|
284
|
+
## 0.1.0
|
285
|
+
|
286
|
+
- Fix github issue #1
|
287
|
+
|
288
|
+
|
289
|
+
## 0.1.0
|
290
|
+
|
291
|
+
- Initial release
|