genkaio 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +9 -11
- data/lib/genkaio.rb +1 -1
- data/lib/genkaio/version.rb +1 -1
- data/pkg/genkaio-0.0.1.gem +0 -0
- data/pkg/genkaio-0.0.2.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/bin/genkaio +27 -0
- data/vendor/bundle/ruby/2.7.0/bin/htmldiff +29 -0
- data/vendor/bundle/ruby/2.7.0/bin/ldiff +29 -0
- data/vendor/bundle/ruby/2.7.0/bin/rake +27 -0
- data/vendor/bundle/ruby/2.7.0/bin/rspec +27 -0
- data/vendor/bundle/ruby/2.7.0/cache/diff-lcs-1.3.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/cache/rake-12.3.3.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/cache/rspec-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/cache/rspec-core-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/cache/rspec-expectations-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/cache/rspec-mocks-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/cache/rspec-support-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/.rspec +1 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/Code-of-Conduct.md +74 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/Contributing.md +83 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/History.md +220 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/License.md +39 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/Manifest.txt +37 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/README.rdoc +84 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/Rakefile +57 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/autotest/discover.rb +1 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/bin/htmldiff +32 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/bin/ldiff +6 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/docs/COPYING.txt +339 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/docs/artistic.txt +127 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff-lcs.rb +3 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs.rb +725 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/array.rb +7 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/block.rb +37 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/callbacks.rb +322 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/change.rb +181 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/htmldiff.rb +149 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/hunk.rb +276 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/internals.rb +307 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/ldiff.rb +167 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/lib/diff/lcs/string.rb +5 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/change_spec.rb +65 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/diff_spec.rb +47 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/fixtures/ds1.csv +50 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/fixtures/ds2.csv +51 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/hunk_spec.rb +72 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/issues_spec.rb +49 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/lcs_spec.rb +56 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/ldiff_spec.rb +47 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/patch_spec.rb +422 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/sdiff_spec.rb +214 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/spec_helper.rb +321 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/traverse_balanced_spec.rb +310 -0
- data/vendor/bundle/ruby/2.7.0/gems/diff-lcs-1.3/spec/traverse_sequences_spec.rb +139 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/CONTRIBUTING.rdoc +43 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/Gemfile +3 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/History.rdoc +2344 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/README.rdoc +156 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/Rakefile +41 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/azure-pipelines.yml +11 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/bin/bundle +105 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/bin/console +7 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/bin/rake +29 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/bin/rdoc +29 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/bin/rubocop +29 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/bin/setup +6 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/glossary.rdoc +42 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/jamis.rb +592 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/rake.1 +156 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/rakefile.rdoc +622 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/exe/rake +27 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake.rb +71 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/application.rb +824 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/backtrace.rb +24 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/clean.rb +78 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/cloneable.rb +17 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/cpu_counter.rb +107 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/default_loader.rb +15 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/dsl_definition.rb +195 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/early_time.rb +22 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/ext/core.rb +26 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/ext/string.rb +176 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_creation_task.rb +25 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_list.rb +435 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_task.rb +54 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_utils.rb +137 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_utils_ext.rb +145 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/invocation_chain.rb +57 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/invocation_exception_mixin.rb +17 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/late_time.rb +18 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/linked_list.rb +112 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/loaders/makefile.rb +54 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/multi_task.rb +14 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/packagetask.rb +207 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/phony.rb +16 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/private_reader.rb +21 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/promise.rb +100 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/pseudo_status.rb +30 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/rake_module.rb +67 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/rake_test_loader.rb +27 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/scope.rb +43 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task.rb +413 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task_argument_error.rb +8 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task_arguments.rb +109 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task_manager.rb +324 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/tasklib.rb +12 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/testtask.rb +224 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/thread_history_display.rb +49 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/thread_pool.rb +163 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/trace_output.rb +23 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/version.rb +10 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/win32.rb +51 -0
- data/vendor/bundle/ruby/2.7.0/gems/rake-12.3.3/rake.gemspec +42 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-3.9.0/LICENSE.md +27 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-3.9.0/README.md +43 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-3.9.0/lib/rspec.rb +3 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-3.9.0/lib/rspec/version.rb +5 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/.document +5 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/.yardopts +8 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/Changelog.md +2265 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/LICENSE.md +26 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/README.md +384 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/exe/rspec +4 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/autorun.rb +3 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core.rb +186 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/backtrace_formatter.rb +65 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/coordinator.rb +62 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/example_minimizer.rb +173 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/fork_runner.rb +134 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/server.rb +61 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/shell_command.rb +126 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/shell_runner.rb +73 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/utilities.rb +58 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/configuration.rb +2336 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/configuration_options.rb +233 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/did_you_mean.rb +46 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/drb.rb +113 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/dsl.rb +98 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/example.rb +656 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/example_group.rb +889 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/example_status_persister.rb +235 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/filter_manager.rb +231 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/flat_map.rb +20 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters.rb +272 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/base_bisect_formatter.rb +45 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/base_formatter.rb +70 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/base_text_formatter.rb +75 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/bisect_drb_formatter.rb +29 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/bisect_progress_formatter.rb +157 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/console_codes.rb +68 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/documentation_formatter.rb +102 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/exception_presenter.rb +508 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/helpers.rb +110 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/html_formatter.rb +153 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/html_printer.rb +414 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/html_snippet_extractor.rb +120 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/json_formatter.rb +102 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/profile_formatter.rb +68 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/progress_formatter.rb +29 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/protocol.rb +182 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/snippet_extractor.rb +134 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/syntax_highlighter.rb +91 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/hooks.rb +632 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/invocations.rb +87 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/memoized_helpers.rb +554 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/metadata.rb +498 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/metadata_filter.rb +255 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/null.rb +14 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/rr.rb +31 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/notifications.rb +521 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/option_parser.rb +317 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/ordering.rb +158 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/output_wrapper.rb +29 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/pending.rb +165 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/profiler.rb +34 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/project_initializer.rb +48 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/project_initializer/.rspec +1 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/project_initializer/spec/spec_helper.rb +100 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/rake_task.rb +188 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/reporter.rb +265 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/ruby_project.rb +53 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/runner.rb +204 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/sandbox.rb +37 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/set.rb +54 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/shared_context.rb +55 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/shared_example_group.rb +269 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/shell_escape.rb +49 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/version.rb +9 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/warnings.rb +40 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/world.rb +275 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/.document +5 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/.yardopts +6 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/Changelog.md +1170 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/LICENSE.md +25 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/README.md +320 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations.rb +82 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/configuration.rb +215 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/expectation_target.rb +127 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/fail_with.rb +39 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/failure_aggregator.rb +194 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/handler.rb +170 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/minitest_integration.rb +58 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/syntax.rb +132 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/version.rb +8 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers.rb +1038 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/aliased_matcher.rb +116 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in.rb +52 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/all.rb +86 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/base_matcher.rb +193 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be.rb +288 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_between.rb +77 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_instance_of.rb +26 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_kind_of.rb +20 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_within.rb +72 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/change.rb +428 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/compound.rb +276 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/contain_exactly.rb +302 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/cover.rb +24 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/eq.rb +40 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/eql.rb +34 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/equal.rb +81 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/exist.rb +90 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/has.rb +103 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/include.rb +149 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/match.rb +106 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/operators.rb +128 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/output.rb +200 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/raise_error.rb +230 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/respond_to.rb +174 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/satisfy.rb +60 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/yield.rb +432 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/composable.rb +171 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/dsl.rb +534 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/english_phrasing.rb +58 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +82 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/fail_matchers.rb +42 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/generated_descriptions.rb +41 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/matcher_delegator.rb +35 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/matcher_protocol.rb +99 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/.document +5 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/.yardopts +6 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/Changelog.md +1125 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/LICENSE.md +25 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/README.md +463 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks.rb +130 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance.rb +11 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/chain.rb +111 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/expect_chain_chain.rb +31 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/expectation_chain.rb +50 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/proxy.rb +116 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/recorder.rb +289 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/stub_chain.rb +51 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/stub_chain_chain.rb +23 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/argument_list_matcher.rb +100 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/argument_matchers.rb +322 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/configuration.rb +212 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/error_generator.rb +369 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/example_methods.rb +434 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/instance_method_stasher.rb +146 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/marshal_extension.rb +41 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/have_received.rb +134 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/receive.rb +132 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/receive_message_chain.rb +82 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/receive_messages.rb +77 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/message_chain.rb +87 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/message_expectation.rb +751 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/method_double.rb +287 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/method_reference.rb +202 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/minitest_integration.rb +68 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/mutate_const.rb +339 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/object_reference.rb +149 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/order_group.rb +81 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/proxy.rb +503 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/space.rb +238 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/standalone.rb +3 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/syntax.rb +325 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/targets.rb +124 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/test_double.rb +171 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/verifying_double.rb +129 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/verifying_message_expectation.rb +54 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/verifying_proxy.rb +220 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/version.rb +9 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/Changelog.md +275 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/LICENSE.md +23 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/README.md +40 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support.rb +149 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/caller_filter.rb +83 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/comparable_version.rb +46 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/differ.rb +215 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/directory_maker.rb +63 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/encoded_string.rb +165 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/hunk_generator.rb +47 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/matcher_definition.rb +42 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/method_signature_verifier.rb +438 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/mutex.rb +73 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/object_formatter.rb +275 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/recursive_const_methods.rb +76 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/reentrant_mutex.rb +53 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/ruby_features.rb +176 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/source.rb +75 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/source/location.rb +21 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/source/node.rb +110 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/source/token.rb +87 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec.rb +81 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/deprecation_helpers.rb +64 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/formatting_support.rb +9 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/in_sub_process.rb +69 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/library_wide_checks.rb +150 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/shell_out.rb +89 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/stderr_splitter.rb +63 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/string_matcher.rb +46 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/with_isolated_directory.rb +13 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/version.rb +7 -0
- data/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.9.0/lib/rspec/support/warnings.rb +39 -0
- data/vendor/bundle/ruby/2.7.0/specifications/diff-lcs-1.3.gemspec +51 -0
- data/vendor/bundle/ruby/2.7.0/specifications/rake-12.3.3.gemspec +43 -0
- data/vendor/bundle/ruby/2.7.0/specifications/rspec-3.9.0.gemspec +39 -0
- data/vendor/bundle/ruby/2.7.0/specifications/rspec-core-3.9.0.gemspec +53 -0
- data/vendor/bundle/ruby/2.7.0/specifications/rspec-expectations-3.9.0.gemspec +44 -0
- data/vendor/bundle/ruby/2.7.0/specifications/rspec-mocks-3.9.0.gemspec +44 -0
- data/vendor/bundle/ruby/2.7.0/specifications/rspec-support-3.9.0.gemspec +36 -0
- metadata +348 -4
- data/lib/.genkaio.rb.swp +0 -0
@@ -0,0 +1,149 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
class Diff::LCS::HTMLDiff
|
6
|
+
class << self
|
7
|
+
attr_accessor :can_expand_tabs #:nodoc:
|
8
|
+
end
|
9
|
+
self.can_expand_tabs = true
|
10
|
+
|
11
|
+
class Callbacks
|
12
|
+
attr_accessor :output
|
13
|
+
attr_accessor :match_class
|
14
|
+
attr_accessor :only_a_class
|
15
|
+
attr_accessor :only_b_class
|
16
|
+
|
17
|
+
def initialize(output, options = {})
|
18
|
+
@output = output
|
19
|
+
options ||= {}
|
20
|
+
|
21
|
+
@match_class = options[:match_class] || "match"
|
22
|
+
@only_a_class = options[:only_a_class] || "only_a"
|
23
|
+
@only_b_class = options[:only_b_class] || "only_b"
|
24
|
+
end
|
25
|
+
|
26
|
+
def htmlize(element, css_class)
|
27
|
+
element = " " if element.empty?
|
28
|
+
%Q|<pre class="#{__send__(css_class)}">#{element}</pre>\n|
|
29
|
+
end
|
30
|
+
private :htmlize
|
31
|
+
|
32
|
+
# This will be called with both lines are the same
|
33
|
+
def match(event)
|
34
|
+
@output << htmlize(event.old_element, :match_class)
|
35
|
+
end
|
36
|
+
|
37
|
+
# This will be called when there is a line in A that isn't in B
|
38
|
+
def discard_a(event)
|
39
|
+
@output << htmlize(event.old_element, :only_a_class)
|
40
|
+
end
|
41
|
+
|
42
|
+
# This will be called when there is a line in B that isn't in A
|
43
|
+
def discard_b(event)
|
44
|
+
@output << htmlize(event.new_element, :only_b_class)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
DEFAULT_OPTIONS = {
|
49
|
+
:expand_tabs => nil,
|
50
|
+
:output => nil,
|
51
|
+
:css => nil,
|
52
|
+
:title => nil,
|
53
|
+
}
|
54
|
+
|
55
|
+
DEFAULT_CSS = <<-CSS
|
56
|
+
body { margin: 0; }
|
57
|
+
.diff
|
58
|
+
{
|
59
|
+
border: 1px solid black;
|
60
|
+
margin: 1em 2em;
|
61
|
+
}
|
62
|
+
p
|
63
|
+
{
|
64
|
+
margin-left: 2em;
|
65
|
+
}
|
66
|
+
pre
|
67
|
+
{
|
68
|
+
padding-left: 1em;
|
69
|
+
margin: 0;
|
70
|
+
font-family: Inconsolata, Consolas, Lucida, Courier, monospaced;
|
71
|
+
white-space: pre;
|
72
|
+
}
|
73
|
+
.match { }
|
74
|
+
.only_a
|
75
|
+
{
|
76
|
+
background-color: #fdd;
|
77
|
+
color: red;
|
78
|
+
text-decoration: line-through;
|
79
|
+
}
|
80
|
+
.only_b
|
81
|
+
{
|
82
|
+
background-color: #ddf;
|
83
|
+
color: blue;
|
84
|
+
border-left: 3px solid blue
|
85
|
+
}
|
86
|
+
h1 { margin-left: 2em; }
|
87
|
+
CSS
|
88
|
+
|
89
|
+
def initialize(left, right, options = nil)
|
90
|
+
@left = left
|
91
|
+
@right = right
|
92
|
+
@options = options
|
93
|
+
|
94
|
+
@options = DEFAULT_OPTIONS.dup if @options.nil?
|
95
|
+
end
|
96
|
+
|
97
|
+
def verify_options
|
98
|
+
@options[:expand_tabs] ||= 4
|
99
|
+
@options[:expand_tabs] = 4 if @options[:expand_tabs] < 0
|
100
|
+
|
101
|
+
@options[:output] ||= $stdout
|
102
|
+
|
103
|
+
@options[:css] ||= DEFAULT_CSS.dup
|
104
|
+
|
105
|
+
@options[:title] ||= "diff"
|
106
|
+
end
|
107
|
+
private :verify_options
|
108
|
+
|
109
|
+
attr_reader :options
|
110
|
+
|
111
|
+
def run
|
112
|
+
verify_options
|
113
|
+
|
114
|
+
if @options[:expand_tabs] > 0 && self.class.can_expand_tabs
|
115
|
+
formatter = Text::Format.new
|
116
|
+
formatter.tabstop = @options[:expand_tabs]
|
117
|
+
|
118
|
+
@left.map! { |line| formatter.expand(line.chomp) }
|
119
|
+
@right.map! { |line| formatter.expand(line.chomp) }
|
120
|
+
end
|
121
|
+
|
122
|
+
@left.map! { |line| CGI.escapeHTML(line.chomp) }
|
123
|
+
@right.map! { |line| CGI.escapeHTML(line.chomp) }
|
124
|
+
|
125
|
+
@options[:output] << <<-OUTPUT
|
126
|
+
<html>
|
127
|
+
<head>
|
128
|
+
<title>#{@options[:title]}</title>
|
129
|
+
<style type="text/css">
|
130
|
+
#{@options[:css]}
|
131
|
+
</style>
|
132
|
+
</head>
|
133
|
+
<body>
|
134
|
+
<h1>#{@options[:title]}</h1>
|
135
|
+
<p>Legend: <span class="only_a">Only in Old</span>
|
136
|
+
<span class="only_b">Only in New</span></p>
|
137
|
+
<div class="diff">
|
138
|
+
OUTPUT
|
139
|
+
|
140
|
+
callbacks = Callbacks.new(@options[:output])
|
141
|
+
Diff::LCS.traverse_sequences(@left, @right, callbacks)
|
142
|
+
|
143
|
+
@options[:output] << <<-OUTPUT
|
144
|
+
</div>
|
145
|
+
</body>
|
146
|
+
</html>
|
147
|
+
OUTPUT
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,276 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'diff/lcs/block'
|
4
|
+
|
5
|
+
# A Hunk is a group of Blocks which overlap because of the context
|
6
|
+
# surrounding each block. (So if we're not using context, every hunk will
|
7
|
+
# contain one block.) Used in the diff program (bin/diff).
|
8
|
+
class Diff::LCS::Hunk
|
9
|
+
# Create a hunk using references to both the old and new data, as well as
|
10
|
+
# the piece of data.
|
11
|
+
def initialize(data_old, data_new, piece, flag_context, file_length_difference)
|
12
|
+
# At first, a hunk will have just one Block in it
|
13
|
+
@blocks = [ Diff::LCS::Block.new(piece) ]
|
14
|
+
if String.method_defined?(:encoding)
|
15
|
+
@preferred_data_encoding = data_old.fetch(0, data_new.fetch(0,'') ).encoding
|
16
|
+
end
|
17
|
+
@data_old = data_old
|
18
|
+
@data_new = data_new
|
19
|
+
|
20
|
+
before = after = file_length_difference
|
21
|
+
after += @blocks[0].diff_size
|
22
|
+
@file_length_difference = after # The caller must get this manually
|
23
|
+
|
24
|
+
# Save the start & end of each array. If the array doesn't exist (e.g.,
|
25
|
+
# we're only adding items in this block), then figure out the line
|
26
|
+
# number based on the line number of the other file and the current
|
27
|
+
# difference in file lengths.
|
28
|
+
if @blocks[0].remove.empty?
|
29
|
+
a1 = a2 = nil
|
30
|
+
else
|
31
|
+
a1 = @blocks[0].remove[0].position
|
32
|
+
a2 = @blocks[0].remove[-1].position
|
33
|
+
end
|
34
|
+
|
35
|
+
if @blocks[0].insert.empty?
|
36
|
+
b1 = b2 = nil
|
37
|
+
else
|
38
|
+
b1 = @blocks[0].insert[0].position
|
39
|
+
b2 = @blocks[0].insert[-1].position
|
40
|
+
end
|
41
|
+
|
42
|
+
@start_old = a1 || (b1 - before)
|
43
|
+
@start_new = b1 || (a1 + before)
|
44
|
+
@end_old = a2 || (b2 - after)
|
45
|
+
@end_new = b2 || (a2 + after)
|
46
|
+
|
47
|
+
self.flag_context = flag_context
|
48
|
+
end
|
49
|
+
|
50
|
+
attr_reader :blocks
|
51
|
+
attr_reader :start_old, :start_new
|
52
|
+
attr_reader :end_old, :end_new
|
53
|
+
attr_reader :file_length_difference
|
54
|
+
|
55
|
+
# Change the "start" and "end" fields to note that context should be added
|
56
|
+
# to this hunk.
|
57
|
+
attr_accessor :flag_context
|
58
|
+
undef :flag_context=;
|
59
|
+
def flag_context=(context) #:nodoc:
|
60
|
+
return if context.nil? or context.zero?
|
61
|
+
|
62
|
+
add_start = (context > @start_old) ? @start_old : context
|
63
|
+
@start_old -= add_start
|
64
|
+
@start_new -= add_start
|
65
|
+
|
66
|
+
if (@end_old + context) > @data_old.size
|
67
|
+
add_end = @data_old.size - @end_old
|
68
|
+
else
|
69
|
+
add_end = context
|
70
|
+
end
|
71
|
+
@end_old += add_end
|
72
|
+
@end_new += add_end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Merges this hunk and the provided hunk together if they overlap. Returns
|
76
|
+
# a truthy value so that if there is no overlap, you can know the merge
|
77
|
+
# was skipped.
|
78
|
+
def merge(hunk)
|
79
|
+
if overlaps?(hunk)
|
80
|
+
@start_old = hunk.start_old
|
81
|
+
@start_new = hunk.start_new
|
82
|
+
blocks.unshift(*hunk.blocks)
|
83
|
+
else
|
84
|
+
nil
|
85
|
+
end
|
86
|
+
end
|
87
|
+
alias_method :unshift, :merge
|
88
|
+
|
89
|
+
# Determines whether there is an overlap between this hunk and the
|
90
|
+
# provided hunk. This will be true if the difference between the two hunks
|
91
|
+
# start or end positions is within one position of each other.
|
92
|
+
def overlaps?(hunk)
|
93
|
+
hunk and (((@start_old - hunk.end_old) <= 1) or
|
94
|
+
((@start_new - hunk.end_new) <= 1))
|
95
|
+
end
|
96
|
+
|
97
|
+
# Returns a diff string based on a format.
|
98
|
+
def diff(format)
|
99
|
+
case format
|
100
|
+
when :old
|
101
|
+
old_diff
|
102
|
+
when :unified
|
103
|
+
unified_diff
|
104
|
+
when :context
|
105
|
+
context_diff
|
106
|
+
when :ed
|
107
|
+
self
|
108
|
+
when :reverse_ed, :ed_finish
|
109
|
+
ed_diff(format)
|
110
|
+
else
|
111
|
+
raise "Unknown diff format #{format}."
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Note that an old diff can't have any context. Therefore, we know that
|
116
|
+
# there's only one block in the hunk.
|
117
|
+
def old_diff
|
118
|
+
warn "Expecting only one block in an old diff hunk!" if @blocks.size > 1
|
119
|
+
op_act = { "+" => 'a', "-" => 'd', "!" => "c" }
|
120
|
+
|
121
|
+
block = @blocks[0]
|
122
|
+
|
123
|
+
# Calculate item number range. Old diff range is just like a context
|
124
|
+
# diff range, except the ranges are on one line with the action between
|
125
|
+
# them.
|
126
|
+
s = encode("#{context_range(:old)}#{op_act[block.op]}#{context_range(:new)}\n")
|
127
|
+
# If removing anything, just print out all the remove lines in the hunk
|
128
|
+
# which is just all the remove lines in the block.
|
129
|
+
@data_old[@start_old .. @end_old].each { |e| s << encode("< ") + e + encode("\n") } unless block.remove.empty?
|
130
|
+
s << encode("---\n") if block.op == "!"
|
131
|
+
@data_new[@start_new .. @end_new].each { |e| s << encode("> ") + e + encode("\n") } unless block.insert.empty?
|
132
|
+
s
|
133
|
+
end
|
134
|
+
private :old_diff
|
135
|
+
|
136
|
+
def unified_diff
|
137
|
+
# Calculate item number range.
|
138
|
+
s = encode("@@ -#{unified_range(:old)} +#{unified_range(:new)} @@\n")
|
139
|
+
|
140
|
+
# Outlist starts containing the hunk of the old file. Removing an item
|
141
|
+
# just means putting a '-' in front of it. Inserting an item requires
|
142
|
+
# getting it from the new file and splicing it in. We splice in
|
143
|
+
# +num_added+ items. Remove blocks use +num_added+ because splicing
|
144
|
+
# changed the length of outlist.
|
145
|
+
#
|
146
|
+
# We remove +num_removed+ items. Insert blocks use +num_removed+
|
147
|
+
# because their item numbers -- corresponding to positions in the NEW
|
148
|
+
# file -- don't take removed items into account.
|
149
|
+
lo, hi, num_added, num_removed = @start_old, @end_old, 0, 0
|
150
|
+
|
151
|
+
outlist = @data_old[lo .. hi].map { |e| e.insert(0, encode(' ')) }
|
152
|
+
|
153
|
+
@blocks.each do |block|
|
154
|
+
block.remove.each do |item|
|
155
|
+
op = item.action.to_s # -
|
156
|
+
offset = item.position - lo + num_added
|
157
|
+
outlist[offset][0, 1] = encode(op)
|
158
|
+
num_removed += 1
|
159
|
+
end
|
160
|
+
block.insert.each do |item|
|
161
|
+
op = item.action.to_s # +
|
162
|
+
offset = item.position - @start_new + num_removed
|
163
|
+
outlist[offset, 0] = encode(op) + @data_new[item.position]
|
164
|
+
num_added += 1
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
s << outlist.join(encode("\n"))
|
169
|
+
end
|
170
|
+
private :unified_diff
|
171
|
+
|
172
|
+
def context_diff
|
173
|
+
s = encode("***************\n")
|
174
|
+
s << encode("*** #{context_range(:old)} ****\n")
|
175
|
+
r = context_range(:new)
|
176
|
+
|
177
|
+
# Print out file 1 part for each block in context diff format if there
|
178
|
+
# are any blocks that remove items
|
179
|
+
lo, hi = @start_old, @end_old
|
180
|
+
removes = @blocks.select { |e| not e.remove.empty? }
|
181
|
+
if removes
|
182
|
+
outlist = @data_old[lo .. hi].map { |e| e.insert(0, encode(' ')) }
|
183
|
+
|
184
|
+
removes.each do |block|
|
185
|
+
block.remove.each do |item|
|
186
|
+
outlist[item.position - lo][0, 1] = encode(block.op) # - or !
|
187
|
+
end
|
188
|
+
end
|
189
|
+
s << outlist.join("\n")
|
190
|
+
end
|
191
|
+
|
192
|
+
s << encode("\n--- #{r} ----\n")
|
193
|
+
lo, hi = @start_new, @end_new
|
194
|
+
inserts = @blocks.select { |e| not e.insert.empty? }
|
195
|
+
if inserts
|
196
|
+
outlist = @data_new[lo .. hi].collect { |e| e.insert(0, encode(' ')) }
|
197
|
+
inserts.each do |block|
|
198
|
+
block.insert.each do |item|
|
199
|
+
outlist[item.position - lo][0, 1] = encode(block.op) # + or !
|
200
|
+
end
|
201
|
+
end
|
202
|
+
s << outlist.join("\n")
|
203
|
+
end
|
204
|
+
s
|
205
|
+
end
|
206
|
+
private :context_diff
|
207
|
+
|
208
|
+
def ed_diff(format)
|
209
|
+
op_act = { "+" => 'a', "-" => 'd', "!" => "c" }
|
210
|
+
warn "Expecting only one block in an old diff hunk!" if @blocks.size > 1
|
211
|
+
|
212
|
+
if format == :reverse_ed
|
213
|
+
s = encode("#{op_act[@blocks[0].op]}#{context_range(:old)}\n")
|
214
|
+
else
|
215
|
+
s = encode("#{context_range(:old, ' ')}#{op_act[@blocks[0].op]}\n")
|
216
|
+
end
|
217
|
+
|
218
|
+
unless @blocks[0].insert.empty?
|
219
|
+
@data_new[@start_new .. @end_new].each { |e| s << e + encode("\n") }
|
220
|
+
s << encode(".\n")
|
221
|
+
end
|
222
|
+
s
|
223
|
+
end
|
224
|
+
private :ed_diff
|
225
|
+
|
226
|
+
# Generate a range of item numbers to print. Only print 1 number if the
|
227
|
+
# range has only one item in it. Otherwise, it's 'start,end'
|
228
|
+
def context_range(mode, op = ',')
|
229
|
+
case mode
|
230
|
+
when :old
|
231
|
+
s, e = (@start_old + 1), (@end_old + 1)
|
232
|
+
when :new
|
233
|
+
s, e = (@start_new + 1), (@end_new + 1)
|
234
|
+
end
|
235
|
+
|
236
|
+
(s < e) ? "#{s}#{op}#{e}" : "#{e}"
|
237
|
+
end
|
238
|
+
private :context_range
|
239
|
+
|
240
|
+
# Generate a range of item numbers to print for unified diff. Print number
|
241
|
+
# where block starts, followed by number of lines in the block
|
242
|
+
# (don't print number of lines if it's 1)
|
243
|
+
def unified_range(mode)
|
244
|
+
case mode
|
245
|
+
when :old
|
246
|
+
s, e = (@start_old + 1), (@end_old + 1)
|
247
|
+
when :new
|
248
|
+
s, e = (@start_new + 1), (@end_new + 1)
|
249
|
+
end
|
250
|
+
|
251
|
+
length = e - s + 1
|
252
|
+
first = (length < 2) ? e : s # "strange, but correct"
|
253
|
+
(length == 1) ? "#{first}" : "#{first},#{length}"
|
254
|
+
end
|
255
|
+
private :unified_range
|
256
|
+
|
257
|
+
if String.method_defined?(:encoding)
|
258
|
+
def encode(literal, target_encoding = @preferred_data_encoding)
|
259
|
+
literal.encode target_encoding
|
260
|
+
end
|
261
|
+
|
262
|
+
def encode_as(string, *args)
|
263
|
+
args.map { |arg| arg.encode(string.encoding) }
|
264
|
+
end
|
265
|
+
else
|
266
|
+
def encode(literal, target_encoding = nil)
|
267
|
+
literal
|
268
|
+
end
|
269
|
+
def encode_as(string, *args)
|
270
|
+
args
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
private :encode
|
275
|
+
private :encode_as
|
276
|
+
end
|
@@ -0,0 +1,307 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
|
3
|
+
class << Diff::LCS
|
4
|
+
def diff_traversal(method, seq1, seq2, callbacks, &block)
|
5
|
+
callbacks = callbacks_for(callbacks)
|
6
|
+
case method
|
7
|
+
when :diff
|
8
|
+
traverse_sequences(seq1, seq2, callbacks)
|
9
|
+
when :sdiff
|
10
|
+
traverse_balanced(seq1, seq2, callbacks)
|
11
|
+
end
|
12
|
+
callbacks.finish if callbacks.respond_to? :finish
|
13
|
+
|
14
|
+
if block
|
15
|
+
callbacks.diffs.map do |hunk|
|
16
|
+
if hunk.kind_of? Array
|
17
|
+
hunk.map { |hunk_block| block[hunk_block] }
|
18
|
+
else
|
19
|
+
block[hunk]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
else
|
23
|
+
callbacks.diffs
|
24
|
+
end
|
25
|
+
end
|
26
|
+
private :diff_traversal
|
27
|
+
end
|
28
|
+
|
29
|
+
module Diff::LCS::Internals # :nodoc:
|
30
|
+
end
|
31
|
+
|
32
|
+
class << Diff::LCS::Internals
|
33
|
+
# Compute the longest common subsequence between the sequenced
|
34
|
+
# Enumerables +a+ and +b+. The result is an array whose contents is such
|
35
|
+
# that
|
36
|
+
#
|
37
|
+
# result = Diff::LCS::Internals.lcs(a, b)
|
38
|
+
# result.each_with_index do |e, i|
|
39
|
+
# assert_equal(a[i], b[e]) unless e.nil?
|
40
|
+
# end
|
41
|
+
def lcs(a, b)
|
42
|
+
a_start = b_start = 0
|
43
|
+
a_finish = a.size - 1
|
44
|
+
b_finish = b.size - 1
|
45
|
+
vector = []
|
46
|
+
|
47
|
+
# Prune off any common elements at the beginning...
|
48
|
+
while ((a_start <= a_finish) and (b_start <= b_finish) and
|
49
|
+
(a[a_start] == b[b_start]))
|
50
|
+
vector[a_start] = b_start
|
51
|
+
a_start += 1
|
52
|
+
b_start += 1
|
53
|
+
end
|
54
|
+
b_start = a_start
|
55
|
+
|
56
|
+
# Now the end...
|
57
|
+
while ((a_start <= a_finish) and (b_start <= b_finish) and
|
58
|
+
(a[a_finish] == b[b_finish]))
|
59
|
+
vector[a_finish] = b_finish
|
60
|
+
a_finish -= 1
|
61
|
+
b_finish -= 1
|
62
|
+
end
|
63
|
+
|
64
|
+
# Now, compute the equivalence classes of positions of elements.
|
65
|
+
b_matches = position_hash(b, b_start..b_finish)
|
66
|
+
|
67
|
+
thresh = []
|
68
|
+
links = []
|
69
|
+
string = a.kind_of?(String)
|
70
|
+
|
71
|
+
(a_start .. a_finish).each do |i|
|
72
|
+
ai = string ? a[i, 1] : a[i]
|
73
|
+
bm = b_matches[ai]
|
74
|
+
k = nil
|
75
|
+
bm.reverse_each do |j|
|
76
|
+
if k and (thresh[k] > j) and (thresh[k - 1] < j)
|
77
|
+
thresh[k] = j
|
78
|
+
else
|
79
|
+
k = replace_next_larger(thresh, j, k)
|
80
|
+
end
|
81
|
+
links[k] = [ (k > 0) ? links[k - 1] : nil, i, j ] unless k.nil?
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
unless thresh.empty?
|
86
|
+
link = links[thresh.size - 1]
|
87
|
+
while not link.nil?
|
88
|
+
vector[link[1]] = link[2]
|
89
|
+
link = link[0]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
vector
|
94
|
+
end
|
95
|
+
|
96
|
+
# This method will analyze the provided patchset to provide a
|
97
|
+
# single-pass normalization (conversion of the array form of
|
98
|
+
# Diff::LCS::Change objects to the object form of same) and detection of
|
99
|
+
# whether the patchset represents changes to be made.
|
100
|
+
def analyze_patchset(patchset, depth = 0)
|
101
|
+
raise "Patchset too complex" if depth > 1
|
102
|
+
|
103
|
+
has_changes = false
|
104
|
+
|
105
|
+
# Format:
|
106
|
+
# [ # patchset
|
107
|
+
# # hunk (change)
|
108
|
+
# [ # hunk
|
109
|
+
# # change
|
110
|
+
# ]
|
111
|
+
# ]
|
112
|
+
|
113
|
+
patchset = patchset.map do |hunk|
|
114
|
+
case hunk
|
115
|
+
when Diff::LCS::Change
|
116
|
+
has_changes ||= !hunk.unchanged?
|
117
|
+
hunk
|
118
|
+
when Array
|
119
|
+
# Detect if the 'hunk' is actually an array-format
|
120
|
+
# Change object.
|
121
|
+
if Diff::LCS::Change.valid_action? hunk[0]
|
122
|
+
hunk = Diff::LCS::Change.from_a(hunk)
|
123
|
+
has_changes ||= !hunk.unchanged?
|
124
|
+
hunk
|
125
|
+
else
|
126
|
+
with_changes, hunk = analyze_patchset(hunk, depth + 1)
|
127
|
+
has_changes ||= with_changes
|
128
|
+
hunk.flatten
|
129
|
+
end
|
130
|
+
else
|
131
|
+
raise ArgumentError, "Cannot normalise a hunk of class #{hunk.class}."
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
[ has_changes, patchset.flatten(1) ]
|
136
|
+
end
|
137
|
+
|
138
|
+
# Examine the patchset and the source to see in which direction the
|
139
|
+
# patch should be applied.
|
140
|
+
#
|
141
|
+
# WARNING: By default, this examines the whole patch, so this could take
|
142
|
+
# some time. This also works better with Diff::LCS::ContextChange or
|
143
|
+
# Diff::LCS::Change as its source, as an array will cause the creation
|
144
|
+
# of one of the above.
|
145
|
+
def intuit_diff_direction(src, patchset, limit = nil)
|
146
|
+
string = src.kind_of?(String)
|
147
|
+
count = left_match = left_miss = right_match = right_miss = 0
|
148
|
+
|
149
|
+
patchset.each do |change|
|
150
|
+
count += 1
|
151
|
+
|
152
|
+
case change
|
153
|
+
when Diff::LCS::ContextChange
|
154
|
+
le = string ? src[change.old_position, 1] : src[change.old_position]
|
155
|
+
re = string ? src[change.new_position, 1] : src[change.new_position]
|
156
|
+
|
157
|
+
case change.action
|
158
|
+
when '-' # Remove details from the old string
|
159
|
+
if le == change.old_element
|
160
|
+
left_match += 1
|
161
|
+
else
|
162
|
+
left_miss += 1
|
163
|
+
end
|
164
|
+
when '+'
|
165
|
+
if re == change.new_element
|
166
|
+
right_match += 1
|
167
|
+
else
|
168
|
+
right_miss += 1
|
169
|
+
end
|
170
|
+
when '='
|
171
|
+
left_miss += 1 if le != change.old_element
|
172
|
+
right_miss += 1 if re != change.new_element
|
173
|
+
when '!'
|
174
|
+
if le == change.old_element
|
175
|
+
left_match += 1
|
176
|
+
else
|
177
|
+
if re == change.new_element
|
178
|
+
right_match += 1
|
179
|
+
else
|
180
|
+
left_miss += 1
|
181
|
+
right_miss += 1
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
when Diff::LCS::Change
|
186
|
+
# With a simplistic change, we can't tell the difference between
|
187
|
+
# the left and right on '!' actions, so we ignore those. On '='
|
188
|
+
# actions, if there's a miss, we miss both left and right.
|
189
|
+
element = string ? src[change.position, 1] : src[change.position]
|
190
|
+
|
191
|
+
case change.action
|
192
|
+
when '-'
|
193
|
+
if element == change.element
|
194
|
+
left_match += 1
|
195
|
+
else
|
196
|
+
left_miss += 1
|
197
|
+
end
|
198
|
+
when '+'
|
199
|
+
if element == change.element
|
200
|
+
right_match += 1
|
201
|
+
else
|
202
|
+
right_miss += 1
|
203
|
+
end
|
204
|
+
when '='
|
205
|
+
if element != change.element
|
206
|
+
left_miss += 1
|
207
|
+
right_miss += 1
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
break if (not limit.nil?) && (count > limit)
|
213
|
+
end
|
214
|
+
|
215
|
+
no_left = (left_match == 0) && (left_miss > 0)
|
216
|
+
no_right = (right_match == 0) && (right_miss > 0)
|
217
|
+
|
218
|
+
case [ no_left, no_right ]
|
219
|
+
when [ false, true ]
|
220
|
+
:patch
|
221
|
+
when [ true, false ]
|
222
|
+
:unpatch
|
223
|
+
else
|
224
|
+
case left_match <=> right_match
|
225
|
+
when 1
|
226
|
+
if left_miss.zero?
|
227
|
+
:patch
|
228
|
+
else
|
229
|
+
:unpatch
|
230
|
+
end
|
231
|
+
when -1
|
232
|
+
if right_miss.zero?
|
233
|
+
:unpatch
|
234
|
+
else
|
235
|
+
:patch
|
236
|
+
end
|
237
|
+
else
|
238
|
+
raise "The provided patchset does not appear to apply to the provided enumerable as either source or destination value."
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Find the place at which +value+ would normally be inserted into the
|
244
|
+
# Enumerable. If that place is already occupied by +value+, do nothing
|
245
|
+
# and return +nil+. If the place does not exist (i.e., it is off the end
|
246
|
+
# of the Enumerable), add it to the end. Otherwise, replace the element
|
247
|
+
# at that point with +value+. It is assumed that the Enumerable's values
|
248
|
+
# are numeric.
|
249
|
+
#
|
250
|
+
# This operation preserves the sort order.
|
251
|
+
def replace_next_larger(enum, value, last_index = nil)
|
252
|
+
# Off the end?
|
253
|
+
if enum.empty? or (value > enum[-1])
|
254
|
+
enum << value
|
255
|
+
return enum.size - 1
|
256
|
+
end
|
257
|
+
|
258
|
+
# Binary search for the insertion point
|
259
|
+
last_index ||= enum.size
|
260
|
+
first_index = 0
|
261
|
+
while (first_index <= last_index)
|
262
|
+
i = (first_index + last_index) >> 1
|
263
|
+
|
264
|
+
found = enum[i]
|
265
|
+
|
266
|
+
if value == found
|
267
|
+
return nil
|
268
|
+
elsif value > found
|
269
|
+
first_index = i + 1
|
270
|
+
else
|
271
|
+
last_index = i - 1
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
# The insertion point is in first_index; overwrite the next larger
|
276
|
+
# value.
|
277
|
+
enum[first_index] = value
|
278
|
+
return first_index
|
279
|
+
end
|
280
|
+
private :replace_next_larger
|
281
|
+
|
282
|
+
# If +vector+ maps the matching elements of another collection onto this
|
283
|
+
# Enumerable, compute the inverse of +vector+ that maps this Enumerable
|
284
|
+
# onto the collection. (Currently unused.)
|
285
|
+
def inverse_vector(a, vector)
|
286
|
+
inverse = a.dup
|
287
|
+
(0...vector.size).each do |i|
|
288
|
+
inverse[vector[i]] = i unless vector[i].nil?
|
289
|
+
end
|
290
|
+
inverse
|
291
|
+
end
|
292
|
+
private :inverse_vector
|
293
|
+
|
294
|
+
# Returns a hash mapping each element of an Enumerable to the set of
|
295
|
+
# positions it occupies in the Enumerable, optionally restricted to the
|
296
|
+
# elements specified in the range of indexes specified by +interval+.
|
297
|
+
def position_hash(enum, interval)
|
298
|
+
string = enum.kind_of?(String)
|
299
|
+
hash = Hash.new { |h, k| h[k] = [] }
|
300
|
+
interval.each do |i|
|
301
|
+
k = string ? enum[i, 1] : enum[i]
|
302
|
+
hash[k] << i
|
303
|
+
end
|
304
|
+
hash
|
305
|
+
end
|
306
|
+
private :position_hash
|
307
|
+
end
|