chess_engine 0.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 +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +21 -0
- data/README.md +26 -0
- data/chess_engine.gemspec +14 -0
- data/lib/chess_engine/board.rb +95 -0
- data/lib/chess_engine/cli.rb +105 -0
- data/lib/chess_engine/game.rb +148 -0
- data/lib/chess_engine/input.rb +19 -0
- data/lib/chess_engine/move.rb +35 -0
- data/lib/chess_engine/piece.rb +97 -0
- data/lib/chess_engine/validator.rb +87 -0
- data/lib/chess_engine.rb +1 -0
- data/spec/board_spec.rb +70 -0
- data/spec/game_helper.rb +5 -0
- data/spec/game_spec.rb +79 -0
- data/spec/spec_helper.rb +100 -0
- data/spec/validator_spec.rb +26 -0
- data/vendor/bundle/bin/coderay +27 -0
- data/vendor/bundle/bin/pry +27 -0
- data/vendor/bundle/cache/coderay-1.1.2.gem +0 -0
- data/vendor/bundle/cache/colorize-0.8.1.gem +0 -0
- data/vendor/bundle/cache/method_source-0.9.2.gem +0 -0
- data/vendor/bundle/cache/pry-0.12.2.gem +0 -0
- data/vendor/bundle/cache/rb-readline-0.5.5.gem +0 -0
- data/vendor/bundle/gems/coderay-1.1.2/MIT-LICENSE +22 -0
- data/vendor/bundle/gems/coderay-1.1.2/README_INDEX.rdoc +123 -0
- data/vendor/bundle/gems/coderay-1.1.2/bin/coderay +215 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/duo.rb +81 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/_map.rb +17 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/comment_filter.rb +25 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/count.rb +39 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug.rb +49 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug_lint.rb +63 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/div.rb +23 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/encoder.rb +190 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/filter.rb +58 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/css.rb +65 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/numbering.rb +108 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/output.rb +166 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html.rb +333 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/json.rb +83 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lines_of_code.rb +45 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lint.rb +59 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/null.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/page.rb +24 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/span.rb +23 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/statistic.rb +95 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/terminal.rb +195 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/text.rb +46 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/token_kind_filter.rb +111 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/xml.rb +72 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/yaml.rb +50 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/for_redcloth.rb +95 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/file_type.rb +151 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin.rb +55 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin_host.rb +221 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/word_list.rb +72 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/_map.rb +24 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/c.rb +189 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/clojure.rb +217 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/cpp.rb +217 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/css.rb +196 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/debug.rb +75 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/delphi.rb +144 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/diff.rb +221 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/erb.rb +81 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/go.rb +208 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/groovy.rb +268 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/haml.rb +168 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/html.rb +275 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java/builtin_types.rb +421 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java.rb +174 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java_script.rb +237 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/json.rb +98 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/lua.rb +280 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/php.rb +527 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/python.rb +287 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/raydebug.rb +75 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/patterns.rb +178 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/string_state.rb +79 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby.rb +477 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sass.rb +232 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/scanner.rb +337 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sql.rb +169 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/taskpaper.rb +36 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/text.rb +26 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/xml.rb +17 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/yaml.rb +140 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners.rb +27 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/_map.rb +7 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/alpha.rb +153 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/style.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles.rb +15 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/token_kinds.rb +85 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens.rb +161 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens_proxy.rb +55 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/version.rb +3 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay.rb +284 -0
- data/vendor/bundle/gems/colorize-0.8.1/CHANGELOG +65 -0
- data/vendor/bundle/gems/colorize-0.8.1/LICENSE +339 -0
- data/vendor/bundle/gems/colorize-0.8.1/README.md +105 -0
- data/vendor/bundle/gems/colorize-0.8.1/Rakefile +13 -0
- data/vendor/bundle/gems/colorize-0.8.1/colorize.gemspec +36 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/class_methods.rb +120 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/instance_methods.rb +132 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize.rb +12 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorized_string.rb +19 -0
- data/vendor/bundle/gems/colorize-0.8.1/test/test_colorize.rb +164 -0
- data/vendor/bundle/gems/method_source-0.9.2/Gemfile +2 -0
- data/vendor/bundle/gems/method_source-0.9.2/LICENSE +25 -0
- data/vendor/bundle/gems/method_source-0.9.2/README.markdown +91 -0
- data/vendor/bundle/gems/method_source-0.9.2/Rakefile +81 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/code_helpers.rb +154 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/source_location.rb +138 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/version.rb +3 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source.rb +141 -0
- data/vendor/bundle/gems/method_source-0.9.2/method_source.gemspec +35 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/method_source/code_helpers_spec.rb +43 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/method_source_spec.rb +143 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/spec_helper.rb +101 -0
- data/vendor/bundle/gems/pry-0.12.2/CHANGELOG.md +953 -0
- data/vendor/bundle/gems/pry-0.12.2/LICENSE +25 -0
- data/vendor/bundle/gems/pry-0.12.2/README.md +390 -0
- data/vendor/bundle/gems/pry-0.12.2/bin/pry +8 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/basic_object.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/cli.rb +218 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_file.rb +110 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_range.rb +71 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/loc.rb +98 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code.rb +353 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code_object.rb +195 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/color_printer.rb +65 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/command.rb +723 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/command_set.rb +415 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/amend_line.rb +98 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang.rb +20 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang_pry.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/abstract_formatter.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/exception_formatter.rb +79 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/file_formatter.rb +71 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat.rb +63 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cd.rb +41 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_inspector.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_prompt.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/clear_screen.rb +14 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/code_collector.rb +167 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disable_pry.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disabled_commands.rb +2 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/easter_eggs.rb +112 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/exception_patcher.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/file_and_line_locator.rb +36 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit.rb +200 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit.rb +43 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_all.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_program.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/find_method.rb +191 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/fix_indent.rb +19 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_cd.rb +26 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_install.rb +32 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_list.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_open.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_readme.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_search.rb +40 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_stats.rb +83 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gist.rb +102 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/help.rb +164 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/hist.rb +181 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/import_set.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/install_command.rb +54 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/jump_to.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/list_inspectors.rb +35 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/constants.rb +58 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/formatter.rb +51 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/globals.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/grep.rb +19 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/instance_vars.rb +38 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/interrogatable.rb +18 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/jruby_hacks.rb +49 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_names.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_vars.rb +37 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb +69 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods.rb +54 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/self_methods.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls.rb +113 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/nesting.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/play.rb +102 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_backtrace.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_version.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/raise_up.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reload_code.rb +62 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reset.rb +18 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ri.rb +65 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/save_file.rb +61 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_command.rb +75 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_mode.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_doc.rb +81 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_info.rb +216 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_input.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_source.rb +53 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/stat.rb +40 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/switch_to.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/toggle_color.rb +24 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression/expression.rb +38 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression.rb +107 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/whereami.rb +197 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/wtf.rb +70 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/behavior.rb +255 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/convenience.rb +28 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/default.rb +159 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/memoization.rb +48 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config.rb +35 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/core_extensions.rb +142 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/editor.rb +128 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/exceptions.rb +76 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/forwardable.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/base_helpers.rb +200 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/command_helpers.rb +157 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/documentation_helpers.rb +76 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/platform.rb +58 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/table.rb +114 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/text.rb +115 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/history.rb +161 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/hooks.rb +171 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/indent.rb +408 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_completer.rb +265 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_lock.rb +130 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/inspector.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/last_exception.rb +61 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/disowned.rb +55 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/patcher.rb +122 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb +198 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method.rb +552 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/object_path.rb +83 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/output.rb +50 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pager.rb +250 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/platform.rb +91 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/plugins.rb +122 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/prompt.rb +145 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_class.rb +425 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_instance.rb +699 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl.rb +261 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl_file_loader.rb +73 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/ring.rb +84 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/rubygem.rb +84 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/LICENSE +20 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/commands.rb +195 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/option.rb +206 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop.rb +661 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/terminal.rb +91 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/evalable.rb +15 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/mockable.rb +14 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/pry_tester.rb +73 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/utility.rb +26 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/variables.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable.rb +70 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/version.rb +3 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module/candidate.rb +131 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module.rb +378 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry.rb +132 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/CHANGES +94 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/LICENSE +25 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/README.md +81 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/Rakefile +25 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/bench/_rl_adjust_point.rb +26 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline.rb +8 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline_with_completion.rb +18 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/tinyirb.rb +11 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rb-readline.rb +18 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline/version.rb +3 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline.rb +8920 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/readline.rb +539 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/rb-readline.gemspec +51 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/setup.rb +1585 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/support/filesystem_completion_helper.rb +53 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_completion.rb +100 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_filename_completion_proc.rb +88 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_history.rb +29 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_rbreadline.rb +23 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_readline.rb +221 -0
- data/vendor/bundle/specifications/coderay-1.1.2.gemspec +26 -0
- data/vendor/bundle/specifications/colorize-0.8.1.gemspec +38 -0
- data/vendor/bundle/specifications/method_source-0.9.2.gemspec +35 -0
- data/vendor/bundle/specifications/pry-0.12.2.gemspec +38 -0
- data/vendor/bundle/specifications/rb-readline-0.5.5.gemspec +39 -0
- metadata +363 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
class Pry::Terminal
|
3
|
+
class << self
|
4
|
+
# Return a pair of [rows, columns] which gives the size of the window.
|
5
|
+
#
|
6
|
+
# If the window size cannot be determined, return nil.
|
7
|
+
def screen_size
|
8
|
+
rows, cols = actual_screen_size
|
9
|
+
if rows.to_i != 0 && cols.to_i != 0
|
10
|
+
[rows.to_i, cols.to_i]
|
11
|
+
else
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Return a screen size or a default if that fails.
|
17
|
+
def size! default = [27, 80]
|
18
|
+
screen_size || default
|
19
|
+
end
|
20
|
+
|
21
|
+
# Return a screen width or the default if that fails.
|
22
|
+
def width!
|
23
|
+
size![1]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return a screen height or the default if that fails.
|
27
|
+
def height!
|
28
|
+
size![0]
|
29
|
+
end
|
30
|
+
|
31
|
+
def actual_screen_size
|
32
|
+
# The best way, if possible (requires non-jruby ≥1.9 or io-console gem)
|
33
|
+
screen_size_according_to_io_console or
|
34
|
+
# Fall back to the old standby, though it might be stale:
|
35
|
+
screen_size_according_to_env or
|
36
|
+
# Fall further back, though this one is also out of date without something
|
37
|
+
# calling Readline.set_screen_size
|
38
|
+
screen_size_according_to_readline or
|
39
|
+
# Windows users can otherwise run ansicon and get a decent answer:
|
40
|
+
screen_size_according_to_ansicon_env
|
41
|
+
end
|
42
|
+
|
43
|
+
def screen_size_according_to_io_console
|
44
|
+
return if Pry::Helpers::Platform.jruby?
|
45
|
+
|
46
|
+
begin
|
47
|
+
require 'io/console'
|
48
|
+
|
49
|
+
begin
|
50
|
+
if $stdout.respond_to?(:tty?) && $stdout.tty? && $stdout.respond_to?(:winsize)
|
51
|
+
$stdout.winsize
|
52
|
+
end
|
53
|
+
rescue Errno::EOPNOTSUPP
|
54
|
+
# $stdout is probably a socket, which doesn't support #winsize.
|
55
|
+
end
|
56
|
+
rescue LoadError
|
57
|
+
# They probably don't have the io/console stdlib or the io-console gem.
|
58
|
+
# We'll keep trying.
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def screen_size_according_to_env
|
63
|
+
size = [ENV['LINES'] || ENV['ROWS'], ENV['COLUMNS']]
|
64
|
+
size if nonzero_column?(size)
|
65
|
+
end
|
66
|
+
|
67
|
+
def screen_size_according_to_readline
|
68
|
+
if defined?(Readline) && Readline.respond_to?(:get_screen_size)
|
69
|
+
size = Readline.get_screen_size
|
70
|
+
size if nonzero_column?(size)
|
71
|
+
end
|
72
|
+
rescue Java::JavaLang::NullPointerException
|
73
|
+
# This rescue won't happen on jrubies later than:
|
74
|
+
# https://github.com/jruby/jruby/pull/436
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
|
78
|
+
def screen_size_according_to_ansicon_env
|
79
|
+
return unless ENV['ANSICON'] =~ /\((.*)x(.*)\)/
|
80
|
+
|
81
|
+
size = [$2, $1]
|
82
|
+
size if nonzero_column?(size)
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def nonzero_column?(size)
|
88
|
+
size[1].to_i > 0
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Pry::Testable::Evalable
|
2
|
+
def pry_tester(*args, &block)
|
3
|
+
if args.length == 0 || args[0].is_a?(Hash)
|
4
|
+
args.unshift(Pry.toplevel_binding)
|
5
|
+
end
|
6
|
+
Pry::Testable::PryTester.new(*args).tap do |t|
|
7
|
+
t.singleton_class.class_eval(&block) if block
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def pry_eval(*eval_strs)
|
12
|
+
b = String === eval_strs.first ? Pry.toplevel_binding : Pry.binding_for(eval_strs.shift)
|
13
|
+
pry_tester(b).eval(*eval_strs)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Pry::Testable::Mockable
|
2
|
+
def mock_command(cmd, args = [], opts = {})
|
3
|
+
output = StringIO.new
|
4
|
+
pry = Pry.new(output: output)
|
5
|
+
ret = cmd.new(opts.merge(pry_instance: pry, output: output)).call_safely(*args)
|
6
|
+
Struct.new(:output, :return).new(output.string, ret)
|
7
|
+
end
|
8
|
+
|
9
|
+
def mock_exception(*mock_backtrace)
|
10
|
+
StandardError.new.tap do |e|
|
11
|
+
e.define_singleton_method(:backtrace) { mock_backtrace }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class Pry::Testable::PryTester
|
2
|
+
extend Pry::Forwardable
|
3
|
+
attr_reader :pry, :out
|
4
|
+
def_delegators :@pry, :eval_string, :eval_string=
|
5
|
+
|
6
|
+
def initialize(target = TOPLEVEL_BINDING, options = {})
|
7
|
+
@pry = Pry.new(options.merge(target: target))
|
8
|
+
@history = options[:history]
|
9
|
+
@pry.inject_sticky_locals!
|
10
|
+
reset_output
|
11
|
+
end
|
12
|
+
|
13
|
+
def eval(*strs)
|
14
|
+
reset_output
|
15
|
+
result = nil
|
16
|
+
|
17
|
+
strs.flatten.each do |str|
|
18
|
+
# Check for space prefix. See #1369.
|
19
|
+
if str !~ /^\s\S/
|
20
|
+
str = "#{str.strip}\n"
|
21
|
+
end
|
22
|
+
@history.push str if @history
|
23
|
+
|
24
|
+
if @pry.process_command(str)
|
25
|
+
result = last_command_result_or_output
|
26
|
+
else
|
27
|
+
result = @pry.evaluate_ruby(str)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
result
|
32
|
+
end
|
33
|
+
|
34
|
+
def push(*lines)
|
35
|
+
Array(lines).flatten.each do |line|
|
36
|
+
@pry.eval(line)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def push_binding(context)
|
41
|
+
@pry.push_binding context
|
42
|
+
end
|
43
|
+
|
44
|
+
def last_output
|
45
|
+
@out.string if @out
|
46
|
+
end
|
47
|
+
|
48
|
+
def process_command(command_str)
|
49
|
+
@pry.process_command(command_str) or raise "Not a valid command"
|
50
|
+
last_command_result_or_output
|
51
|
+
end
|
52
|
+
|
53
|
+
def last_command_result
|
54
|
+
result = Pry.current[:pry_cmd_result]
|
55
|
+
result.retval if result
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
|
60
|
+
def last_command_result_or_output
|
61
|
+
result = last_command_result
|
62
|
+
if result != Pry::Command::VOID_VALUE
|
63
|
+
result
|
64
|
+
else
|
65
|
+
last_output
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def reset_output
|
70
|
+
@out = StringIO.new
|
71
|
+
@pry.output = @out
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Pry::Testable::Utility
|
2
|
+
#
|
3
|
+
# Creates a Tempfile then unlinks it after the block has yielded.
|
4
|
+
#
|
5
|
+
# @yieldparam [String] file
|
6
|
+
# The path of the temp file
|
7
|
+
#
|
8
|
+
# @return [void]
|
9
|
+
#
|
10
|
+
def temp_file(ext = '.rb')
|
11
|
+
file = Tempfile.open(['pry', ext])
|
12
|
+
yield file
|
13
|
+
ensure
|
14
|
+
file.close(true) if file
|
15
|
+
end
|
16
|
+
|
17
|
+
def unindent(*args)
|
18
|
+
Pry::Helpers::CommandHelpers.unindent(*args)
|
19
|
+
end
|
20
|
+
|
21
|
+
def inner_scope
|
22
|
+
catch(:inner_scope) do
|
23
|
+
yield -> { throw(:inner_scope, self) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Pry::Testable::Variables
|
2
|
+
#
|
3
|
+
# @example
|
4
|
+
# temporary_constants(:Foo, :Bar) do
|
5
|
+
# Foo = Class.new(RuntimeError)
|
6
|
+
# Bar = Class.new(RuntimeError)
|
7
|
+
# end
|
8
|
+
# Foo # => NameError
|
9
|
+
# Bar # => NameError
|
10
|
+
#
|
11
|
+
# @param [Array<Symbol>] names
|
12
|
+
# An array of constant names that be defined by a block,
|
13
|
+
# and removed by this method afterwards.
|
14
|
+
#
|
15
|
+
# @return [void]
|
16
|
+
#
|
17
|
+
def temporary_constants(*names)
|
18
|
+
names.each do |name|
|
19
|
+
Object.remove_const name if Object.const_defined?(name)
|
20
|
+
end
|
21
|
+
yield
|
22
|
+
ensure
|
23
|
+
names.each do |name|
|
24
|
+
Object.remove_const name if Object.const_defined?(name)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# @param [String] name
|
30
|
+
# The name of a variable.
|
31
|
+
#
|
32
|
+
# @param [String] value
|
33
|
+
# Its value.
|
34
|
+
#
|
35
|
+
# @param [Binding] b
|
36
|
+
# The binding object to insert a variable into.
|
37
|
+
#
|
38
|
+
# @return [void]
|
39
|
+
#
|
40
|
+
def insert_variable(name, value, b)
|
41
|
+
Pry.current[:pry_local] = value
|
42
|
+
b.eval("#{name} = ::Pry.current[:pry_local]")
|
43
|
+
ensure
|
44
|
+
Pry.current[:pry_local] = nil
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# good idea ???
|
2
|
+
# if you're testing pry plugin you should require pry by yourself, no?
|
3
|
+
require 'pry' if not defined?(Pry)
|
4
|
+
|
5
|
+
module Pry::Testable
|
6
|
+
extend self
|
7
|
+
require_relative "testable/pry_tester"
|
8
|
+
require_relative "testable/evalable"
|
9
|
+
require_relative "testable/mockable"
|
10
|
+
require_relative "testable/variables"
|
11
|
+
require_relative "testable/utility"
|
12
|
+
|
13
|
+
#
|
14
|
+
# When {Pry::Testable} is included into another module or class,
|
15
|
+
# the following modules are also included: {Pry::Testable::Mockable},
|
16
|
+
# {Pry::Testable::Evalable}, {Pry::Testable::Variables}, and
|
17
|
+
# {Pry::Testable::Utility}.
|
18
|
+
#
|
19
|
+
# @note
|
20
|
+
# Each of the included modules mentioned above may also be used
|
21
|
+
# standalone or in a pick-and-mix fashion.
|
22
|
+
#
|
23
|
+
# @param [Module] mod
|
24
|
+
# A class or module.
|
25
|
+
#
|
26
|
+
# @return [void]
|
27
|
+
#
|
28
|
+
def self.included(mod)
|
29
|
+
mod.module_eval do
|
30
|
+
include Pry::Testable::Mockable
|
31
|
+
include Pry::Testable::Evalable
|
32
|
+
include Pry::Testable::Variables
|
33
|
+
include Pry::Testable::Utility
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
TEST_DEFAULTS = {
|
38
|
+
color: false,
|
39
|
+
pager: false,
|
40
|
+
should_load_rc: false,
|
41
|
+
should_load_local_rc: false,
|
42
|
+
correct_indent: false,
|
43
|
+
collison_warning: false,
|
44
|
+
history: {
|
45
|
+
should_load: false,
|
46
|
+
should_save: false
|
47
|
+
}
|
48
|
+
}
|
49
|
+
private_constant :TEST_DEFAULTS
|
50
|
+
|
51
|
+
#
|
52
|
+
# Sets various configuration options that make Pry optimal for a test
|
53
|
+
# environment, see source code for complete details.
|
54
|
+
#
|
55
|
+
# @return [void]
|
56
|
+
#
|
57
|
+
def self.set_testenv_variables
|
58
|
+
Pry.config = Pry::Config.from_hash(TEST_DEFAULTS, Pry::Config::Default.new)
|
59
|
+
Pry.config.hooks = Pry::Hooks.new
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Reset the Pry configuration to their default values.
|
64
|
+
#
|
65
|
+
# @return [void]
|
66
|
+
#
|
67
|
+
def self.unset_testenv_variables
|
68
|
+
Pry.config = Pry::Config.from_hash({}, Pry::Config::Default.new)
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'pry/helpers/documentation_helpers'
|
2
|
+
|
3
|
+
class Pry
|
4
|
+
class WrappedModule
|
5
|
+
# This class represents a single candidate for a module/class definition.
|
6
|
+
# It provides access to the source, documentation, line and file
|
7
|
+
# for a monkeypatch (reopening) of a class/module.
|
8
|
+
class Candidate
|
9
|
+
include Pry::Helpers::DocumentationHelpers
|
10
|
+
include Pry::CodeObject::Helpers
|
11
|
+
extend Pry::Forwardable
|
12
|
+
|
13
|
+
# @return [String] The file where the module definition is located.
|
14
|
+
attr_reader :file
|
15
|
+
alias_method :source_file, :file
|
16
|
+
|
17
|
+
# @return [Fixnum] The line where the module definition is located.
|
18
|
+
attr_reader :line
|
19
|
+
alias_method :source_line, :line
|
20
|
+
|
21
|
+
# Methods to delegate to associated `Pry::WrappedModule
|
22
|
+
# instance`.
|
23
|
+
private_delegates = [:lines_for_file, :method_candidates, :yard_docs?, :name]
|
24
|
+
public_delegates = [:wrapped, :module?, :class?, :nonblank_name,
|
25
|
+
:number_of_candidates]
|
26
|
+
|
27
|
+
def_delegators :@wrapper, *public_delegates
|
28
|
+
def_private_delegators :@wrapper, *private_delegates
|
29
|
+
|
30
|
+
# @raise [Pry::CommandError] If `rank` is out of bounds.
|
31
|
+
# @param [Pry::WrappedModule] wrapper The associated
|
32
|
+
# `Pry::WrappedModule` instance that owns the candidates.
|
33
|
+
# @param [Fixnum] rank The rank of the candidate to
|
34
|
+
# retrieve. Passing 0 returns 'primary candidate' (the candidate with largest
|
35
|
+
# number of methods), passing 1 retrieves candidate with
|
36
|
+
# second largest number of methods, and so on, up to
|
37
|
+
# `Pry::WrappedModule#number_of_candidates() - 1`
|
38
|
+
def initialize(wrapper, rank)
|
39
|
+
@wrapper = wrapper
|
40
|
+
|
41
|
+
if number_of_candidates <= 0
|
42
|
+
raise CommandError, "Cannot find a definition for #{name} module!"
|
43
|
+
elsif rank > (number_of_candidates - 1)
|
44
|
+
raise CommandError, "No such module candidate. Allowed candidates range is from 0 to #{number_of_candidates - 1}"
|
45
|
+
end
|
46
|
+
|
47
|
+
@source = @source_location = nil
|
48
|
+
@rank = rank
|
49
|
+
@file, @line = source_location
|
50
|
+
end
|
51
|
+
|
52
|
+
# @raise [Pry::CommandError] If source code cannot be found.
|
53
|
+
# @return [String] The source for the candidate, i.e the
|
54
|
+
# complete module/class definition.
|
55
|
+
def source
|
56
|
+
return nil if file.nil?
|
57
|
+
return @source if @source
|
58
|
+
|
59
|
+
@source ||= strip_leading_whitespace(Pry::Code.from_file(file).expression_at(line, number_of_lines_in_first_chunk))
|
60
|
+
end
|
61
|
+
|
62
|
+
# @raise [Pry::CommandError] If documentation cannot be found.
|
63
|
+
# @return [String] The documentation for the candidate.
|
64
|
+
def doc
|
65
|
+
return nil if file.nil?
|
66
|
+
|
67
|
+
@doc ||= get_comment_content(Pry::Code.from_file(file).comment_describing(line))
|
68
|
+
end
|
69
|
+
|
70
|
+
# @return [Array, nil] A `[String, Fixnum]` pair representing the
|
71
|
+
# source location (file and line) for the candidate or `nil`
|
72
|
+
# if no source location found.
|
73
|
+
def source_location
|
74
|
+
return @source_location if @source_location
|
75
|
+
|
76
|
+
file, line = first_method_source_location
|
77
|
+
return nil if !file.is_a?(String)
|
78
|
+
|
79
|
+
@source_location = [file, first_line_of_module_definition(file, line)]
|
80
|
+
rescue Pry::RescuableException
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
# Locate the first line of the module definition.
|
87
|
+
# @param [String] file The file that contains the module
|
88
|
+
# definition (somewhere).
|
89
|
+
# @param [Fixnum] line The module definition should appear
|
90
|
+
# before this line (if it exists).
|
91
|
+
# @return [Fixnum] The line where the module is defined. This
|
92
|
+
# line number is one-indexed.
|
93
|
+
def first_line_of_module_definition(file, line)
|
94
|
+
searchable_lines = lines_for_file(file)[0..(line - 2)]
|
95
|
+
searchable_lines.rindex { |v| class_regexes.any? { |r| r =~ v } } + 1
|
96
|
+
end
|
97
|
+
|
98
|
+
def class_regexes
|
99
|
+
mod_type_string = wrapped.class.to_s.downcase
|
100
|
+
[/^\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped.name.split(/::/).last}/,
|
101
|
+
/^\s*(::)?#{wrapped.name.split(/::/).last}\s*?=\s*?#{wrapped.class}/,
|
102
|
+
/^\s*(::)?#{wrapped.name.split(/::/).last}\.(class|instance)_eval/]
|
103
|
+
end
|
104
|
+
|
105
|
+
# This method is used by `Candidate#source_location` as a
|
106
|
+
# starting point for the search for the candidate's definition.
|
107
|
+
# @return [Array] The source location of the base method used to
|
108
|
+
# calculate the source location of the candidate.
|
109
|
+
def first_method_source_location
|
110
|
+
@first_method_source_location ||= method_candidates[@rank].first.source_location
|
111
|
+
end
|
112
|
+
|
113
|
+
# @return [Array] The source location of the last method in this
|
114
|
+
# candidate's module definition.
|
115
|
+
def last_method_source_location
|
116
|
+
@end_method_source_location ||= method_candidates[@rank].last.source_location
|
117
|
+
end
|
118
|
+
|
119
|
+
# Return the number of lines between the start of the class definition
|
120
|
+
# and the start of the last method. We use this value so we can
|
121
|
+
# quickly grab these lines from the file (without having to
|
122
|
+
# check each intervening line for validity, which is expensive) speeding up source extraction.
|
123
|
+
# @return [Fixum] Number of lines.
|
124
|
+
def number_of_lines_in_first_chunk
|
125
|
+
end_method_line = last_method_source_location.last
|
126
|
+
|
127
|
+
end_method_line - line
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|