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,197 @@
|
|
1
|
+
class Pry
|
2
|
+
class Command::Whereami < Pry::ClassCommand
|
3
|
+
def initialize(*)
|
4
|
+
super
|
5
|
+
|
6
|
+
@method_code = nil
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_accessor :method_size_cutoff
|
11
|
+
end
|
12
|
+
|
13
|
+
@method_size_cutoff = 30
|
14
|
+
|
15
|
+
match 'whereami'
|
16
|
+
description 'Show code surrounding the current context.'
|
17
|
+
group 'Context'
|
18
|
+
|
19
|
+
banner <<-'BANNER'
|
20
|
+
Usage: whereami [-qn] [LINES]
|
21
|
+
|
22
|
+
Describe the current location. If you use `binding.pry` inside a method then
|
23
|
+
whereami will print out the source for that method.
|
24
|
+
|
25
|
+
If a number is passed, then LINES lines before and after the current line will be
|
26
|
+
shown instead of the method itself.
|
27
|
+
|
28
|
+
The `-q` flag can be used to suppress error messages in the case that there's
|
29
|
+
no code to show. This is used by pry in the default before_session hook to show
|
30
|
+
you when you arrive at a `binding.pry`.
|
31
|
+
|
32
|
+
The `-n` flag can be used to hide line numbers so that code can be copy/pasted
|
33
|
+
effectively.
|
34
|
+
|
35
|
+
When pry was started on an Object and there is no associated method, whereami
|
36
|
+
will instead output a brief description of the current object.
|
37
|
+
BANNER
|
38
|
+
|
39
|
+
def setup
|
40
|
+
@file = expand_path(target.eval('__FILE__'))
|
41
|
+
@line = target.eval('__LINE__')
|
42
|
+
@method = Pry::Method.from_binding(target)
|
43
|
+
end
|
44
|
+
|
45
|
+
def options(opt)
|
46
|
+
opt.on :q, :quiet, "Don't display anything in case of an error"
|
47
|
+
opt.on :n, :"no-line-numbers", "Do not display line numbers"
|
48
|
+
opt.on :m, :"method", "Show the complete source for the current method."
|
49
|
+
opt.on :c, :"class", "Show the complete source for the current class or module."
|
50
|
+
opt.on :f, :"file", "Show the complete source for the current file."
|
51
|
+
end
|
52
|
+
|
53
|
+
def code
|
54
|
+
@code ||= if opts.present?(:m)
|
55
|
+
method_code or raise CommandError, "Cannot find method code."
|
56
|
+
elsif opts.present?(:c)
|
57
|
+
class_code or raise CommandError, "Cannot find class code."
|
58
|
+
elsif opts.present?(:f)
|
59
|
+
Pry::Code.from_file(@file)
|
60
|
+
elsif args.any?
|
61
|
+
code_window
|
62
|
+
else
|
63
|
+
default_code
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def code?
|
68
|
+
!!code
|
69
|
+
rescue MethodSource::SourceNotFoundError
|
70
|
+
false
|
71
|
+
end
|
72
|
+
|
73
|
+
def bad_option_combination?
|
74
|
+
[opts.present?(:m), opts.present?(:f),
|
75
|
+
opts.present?(:c), args.any?].count(true) > 1
|
76
|
+
end
|
77
|
+
|
78
|
+
def location
|
79
|
+
"#{@file} @ line #{@line} #{@method && @method.name_with_owner}"
|
80
|
+
end
|
81
|
+
|
82
|
+
def process
|
83
|
+
if bad_option_combination?
|
84
|
+
raise CommandError, "Only one of -m, -c, -f, and LINES may be specified."
|
85
|
+
end
|
86
|
+
|
87
|
+
if nothing_to_do?
|
88
|
+
return
|
89
|
+
elsif internal_binding?(target)
|
90
|
+
handle_internal_binding
|
91
|
+
return
|
92
|
+
end
|
93
|
+
|
94
|
+
set_file_and_dir_locals(@file)
|
95
|
+
|
96
|
+
out = "\n#{bold('From:')} #{location}:\n\n" <<
|
97
|
+
code.with_line_numbers(use_line_numbers?).with_marker(marker).highlighted << "\n"
|
98
|
+
|
99
|
+
_pry_.pager.page out
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def nothing_to_do?
|
105
|
+
opts.quiet? && (internal_binding?(target) || !code?)
|
106
|
+
end
|
107
|
+
|
108
|
+
def use_line_numbers?
|
109
|
+
!opts.present?(:n)
|
110
|
+
end
|
111
|
+
|
112
|
+
def marker
|
113
|
+
!opts.present?(:n) && @line
|
114
|
+
end
|
115
|
+
|
116
|
+
def top_level?
|
117
|
+
target_self == Pry.main
|
118
|
+
end
|
119
|
+
|
120
|
+
def handle_internal_binding
|
121
|
+
if top_level?
|
122
|
+
output.puts "At the top level."
|
123
|
+
else
|
124
|
+
output.puts "Inside #{Pry.view_clip(target_self)}."
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def small_method?
|
129
|
+
@method.source_range.count < self.class.method_size_cutoff
|
130
|
+
end
|
131
|
+
|
132
|
+
def default_code
|
133
|
+
if method_code && small_method?
|
134
|
+
method_code
|
135
|
+
else
|
136
|
+
code_window
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def code_window
|
141
|
+
Pry::Code.from_file(@file).around(@line, window_size)
|
142
|
+
end
|
143
|
+
|
144
|
+
def method_code
|
145
|
+
return @method_code if @method_code
|
146
|
+
|
147
|
+
if valid_method?
|
148
|
+
@method_code = Pry::Code.from_method(@method)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# This either returns the `target_self`
|
153
|
+
# or it returns the class of `target_self` if `target_self` is not a class.
|
154
|
+
# @return [Pry::WrappedModule]
|
155
|
+
def target_class
|
156
|
+
return Pry::WrappedModule(target_self) if target_self.is_a?(Module)
|
157
|
+
|
158
|
+
Pry::WrappedModule(target_self.class)
|
159
|
+
end
|
160
|
+
|
161
|
+
def class_code
|
162
|
+
@class_code ||=
|
163
|
+
begin
|
164
|
+
mod = @method ? Pry::WrappedModule(@method.owner) : target_class
|
165
|
+
idx = mod.candidates.find_index { |v| expand_path(v.source_file) == @file }
|
166
|
+
idx && Pry::Code.from_module(mod, idx)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def valid_method?
|
171
|
+
@method && @method.source? && expand_path(@method.source_file) == @file &&
|
172
|
+
@method.source_range.include?(@line)
|
173
|
+
end
|
174
|
+
|
175
|
+
def expand_path(f)
|
176
|
+
return if !f
|
177
|
+
|
178
|
+
if Pry.eval_path == f
|
179
|
+
f
|
180
|
+
else
|
181
|
+
File.expand_path(f)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def window_size
|
186
|
+
if args.empty?
|
187
|
+
_pry_.config.default_window_size
|
188
|
+
else
|
189
|
+
args.first.to_i
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
Pry::Commands.add_command(Pry::Command::Whereami)
|
195
|
+
Pry::Commands.alias_command '@', 'whereami'
|
196
|
+
Pry::Commands.alias_command(/whereami[!?]+/, 'whereami')
|
197
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class Pry
|
2
|
+
class Command::Wtf < Pry::ClassCommand
|
3
|
+
match(/wtf([?!]*)/)
|
4
|
+
group 'Context'
|
5
|
+
description 'Show the backtrace of the most recent exception.'
|
6
|
+
options listing: 'wtf?'
|
7
|
+
|
8
|
+
banner <<-'BANNER'
|
9
|
+
Usage: wtf[?|!]
|
10
|
+
|
11
|
+
Show's a few lines of the backtrace of the most recent exception (also available
|
12
|
+
as `_ex_.backtrace`). If you want to see more lines, add more question marks or
|
13
|
+
exclamation marks.
|
14
|
+
|
15
|
+
wtf?
|
16
|
+
wtf?!???!?!?
|
17
|
+
|
18
|
+
# To see the entire backtrace, pass the `-v` or `--verbose` flag.
|
19
|
+
wtf -v
|
20
|
+
BANNER
|
21
|
+
|
22
|
+
def options(opt)
|
23
|
+
opt.on :v, :verbose, "Show the full backtrace"
|
24
|
+
end
|
25
|
+
|
26
|
+
def process
|
27
|
+
raise Pry::CommandError, "No most-recent exception" unless exception
|
28
|
+
|
29
|
+
output.puts "#{bold('Exception:')} #{exception.class}: #{exception}\n--"
|
30
|
+
if opts.verbose?
|
31
|
+
output.puts with_line_numbers(backtrace)
|
32
|
+
else
|
33
|
+
output.puts with_line_numbers(backtrace.first(size_of_backtrace))
|
34
|
+
end
|
35
|
+
|
36
|
+
if exception.respond_to? :cause
|
37
|
+
cause = exception.cause
|
38
|
+
while cause
|
39
|
+
output.puts "#{text.bold('Caused by:')} #{cause.class}: #{cause}\n--"
|
40
|
+
if opts.verbose?
|
41
|
+
output.puts with_line_numbers(cause.backtrace)
|
42
|
+
else
|
43
|
+
output.puts with_line_numbers(cause.backtrace.first(size_of_backtrace))
|
44
|
+
end
|
45
|
+
cause = cause.cause
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def exception
|
53
|
+
_pry_.last_exception
|
54
|
+
end
|
55
|
+
|
56
|
+
def with_line_numbers(bt)
|
57
|
+
Pry::Code.new(bt, 0, :text).with_line_numbers.to_s
|
58
|
+
end
|
59
|
+
|
60
|
+
def backtrace
|
61
|
+
exception.backtrace
|
62
|
+
end
|
63
|
+
|
64
|
+
def size_of_backtrace
|
65
|
+
[captures[0].size, 0.5].max * 10
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Pry::Commands.add_command(Pry::Command::Wtf)
|
70
|
+
end
|
@@ -0,0 +1,255 @@
|
|
1
|
+
class Pry
|
2
|
+
class Config < Pry::BasicObject
|
3
|
+
module Behavior
|
4
|
+
ASSIGNMENT = "=".freeze
|
5
|
+
NODUP = [TrueClass, FalseClass, NilClass, Symbol, Numeric, Module, Proc].freeze
|
6
|
+
INSPECT_REGEXP = /#{Regexp.escape "default=#<"}/
|
7
|
+
ReservedKeyError = Class.new(RuntimeError)
|
8
|
+
|
9
|
+
module Builder
|
10
|
+
#
|
11
|
+
# Returns a new Behavior, non-recursively (unlike {#from_hash}).
|
12
|
+
#
|
13
|
+
# @param
|
14
|
+
# (see #from_hash)
|
15
|
+
#
|
16
|
+
# @return
|
17
|
+
# (see #from_hash)
|
18
|
+
#
|
19
|
+
def assign(attributes, default = nil)
|
20
|
+
new(default).tap do |behavior|
|
21
|
+
behavior.merge!(attributes)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Returns a new Behavior, recursively walking attributes.
|
27
|
+
#
|
28
|
+
# @param [Hash] attributes
|
29
|
+
# a hash to initialize an instance of self with.
|
30
|
+
#
|
31
|
+
# @param [Pry::Config, nil] default
|
32
|
+
# a default, or nil for none.
|
33
|
+
#
|
34
|
+
# @return [Pry::Config]
|
35
|
+
# returns an instance of self.
|
36
|
+
#
|
37
|
+
def from_hash(attributes, default = nil)
|
38
|
+
new(default).tap do |config|
|
39
|
+
attributes.each do |key,value|
|
40
|
+
config[key] = Hash === value ? from_hash(value, nil) : value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.included(klass)
|
47
|
+
klass.extend(Builder)
|
48
|
+
end
|
49
|
+
|
50
|
+
def initialize(default = Pry.config)
|
51
|
+
@default = default
|
52
|
+
@lookup = {}
|
53
|
+
@reserved_keys = methods.map(&:to_s).freeze
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# @return [Pry::Config::Behavior]
|
58
|
+
# returns the default used incase a key isn't found in self.
|
59
|
+
#
|
60
|
+
def default
|
61
|
+
@default
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# @param [String] key
|
66
|
+
# a key (as a String)
|
67
|
+
#
|
68
|
+
# @return [Object, BasicObject]
|
69
|
+
# returns an object from self or one of its defaults.
|
70
|
+
#
|
71
|
+
def [](key)
|
72
|
+
key = key.to_s
|
73
|
+
key?(key) ? @lookup[key] : (@default and @default[key])
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Add a key and value pair to self.
|
78
|
+
#
|
79
|
+
# @param [String] key
|
80
|
+
# a key (as a String).
|
81
|
+
#
|
82
|
+
# @param [Object,BasicObject] value
|
83
|
+
# a value.
|
84
|
+
#
|
85
|
+
# @raise [Pry::Config::ReservedKeyError]
|
86
|
+
# when 'key' is a reserved key name.
|
87
|
+
#
|
88
|
+
def []=(key, value)
|
89
|
+
key = key.to_s
|
90
|
+
if @reserved_keys.include?(key)
|
91
|
+
raise ReservedKeyError, "It is not possible to use '#{key}' as a key name, please choose a different key name."
|
92
|
+
end
|
93
|
+
|
94
|
+
__push(key,value)
|
95
|
+
end
|
96
|
+
|
97
|
+
#
|
98
|
+
# Removes a key from self.
|
99
|
+
#
|
100
|
+
# @param [String] key
|
101
|
+
# a key (as a String)
|
102
|
+
#
|
103
|
+
# @return [void]
|
104
|
+
#
|
105
|
+
def forget(key)
|
106
|
+
key = key.to_s
|
107
|
+
__remove(key)
|
108
|
+
end
|
109
|
+
|
110
|
+
#
|
111
|
+
# @param [Hash, #to_h, #to_hash] other
|
112
|
+
# a hash to merge into self.
|
113
|
+
#
|
114
|
+
# @return [void]
|
115
|
+
#
|
116
|
+
def merge!(other)
|
117
|
+
other = __try_convert_to_hash(other)
|
118
|
+
raise TypeError, "unable to convert argument into a Hash" unless other
|
119
|
+
|
120
|
+
other.each do |key, value|
|
121
|
+
self[key] = value
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
#
|
126
|
+
# @param [Hash, #to_h, #to_hash] other
|
127
|
+
# a hash to compare against the lookup table of self.
|
128
|
+
#
|
129
|
+
def ==(other)
|
130
|
+
@lookup == __try_convert_to_hash(other)
|
131
|
+
end
|
132
|
+
alias_method :eql?, :==
|
133
|
+
|
134
|
+
#
|
135
|
+
# @param [String] key
|
136
|
+
# a key (as a String)
|
137
|
+
#
|
138
|
+
# @return [Boolean]
|
139
|
+
# returns true when "key" is a member of self.
|
140
|
+
#
|
141
|
+
def key?(key)
|
142
|
+
key = key.to_s
|
143
|
+
@lookup.key?(key)
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# Clear the lookup table of self.
|
148
|
+
#
|
149
|
+
# @return [void]
|
150
|
+
#
|
151
|
+
def clear
|
152
|
+
@lookup.clear
|
153
|
+
true
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# @return [Array<String>]
|
158
|
+
# returns an array of keys in self.
|
159
|
+
#
|
160
|
+
def keys
|
161
|
+
@lookup.keys
|
162
|
+
end
|
163
|
+
|
164
|
+
def eager_load!
|
165
|
+
default = @default
|
166
|
+
while default
|
167
|
+
default.memoized_methods.each { |method| self[key] = default.public_send(key) } if default.respond_to?(:memoized_methods)
|
168
|
+
default = @default.default
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def last_default
|
173
|
+
last = @default
|
174
|
+
last = last.default while last and last.default
|
175
|
+
last
|
176
|
+
end
|
177
|
+
|
178
|
+
#
|
179
|
+
# @return [Hash]
|
180
|
+
# returns a duplicate copy of the lookup table used by self.
|
181
|
+
#
|
182
|
+
def to_hash
|
183
|
+
@lookup.dup
|
184
|
+
end
|
185
|
+
alias_method :to_h, :to_hash
|
186
|
+
|
187
|
+
def inspect
|
188
|
+
key_str = keys.map { |key| "'#{key}'" }.join(",")
|
189
|
+
"#<#{__clip_inspect(self)} keys=[#{key_str}] default=#{@default.inspect}>"
|
190
|
+
end
|
191
|
+
|
192
|
+
def pretty_print(q)
|
193
|
+
q.text inspect[1..-1].gsub(INSPECT_REGEXP, "default=<")
|
194
|
+
end
|
195
|
+
|
196
|
+
def method_missing(name, *args, &block)
|
197
|
+
key = name.to_s
|
198
|
+
if key[-1] == ASSIGNMENT
|
199
|
+
short_key = key[0..-2]
|
200
|
+
self[short_key] = args[0]
|
201
|
+
elsif key?(key)
|
202
|
+
self[key]
|
203
|
+
elsif @default.respond_to?(name)
|
204
|
+
value = @default.public_send(name, *args, &block)
|
205
|
+
self[key] = __dup(value)
|
206
|
+
else
|
207
|
+
nil
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def respond_to_missing?(key, include_all = false)
|
212
|
+
key = key.to_s.chomp(ASSIGNMENT)
|
213
|
+
key?(key) or @default.respond_to?(key) or super(key, include_all)
|
214
|
+
end
|
215
|
+
|
216
|
+
private
|
217
|
+
|
218
|
+
def __clip_inspect(obj)
|
219
|
+
"#{obj.class}:0x%x" % obj.object_id
|
220
|
+
end
|
221
|
+
|
222
|
+
def __try_convert_to_hash(obj)
|
223
|
+
if Hash === obj
|
224
|
+
obj
|
225
|
+
elsif obj.respond_to?(:to_h)
|
226
|
+
obj.to_h
|
227
|
+
elsif obj.respond_to?(:to_hash)
|
228
|
+
obj.to_hash
|
229
|
+
else
|
230
|
+
nil
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def __dup(value)
|
235
|
+
if NODUP.any? { |klass| klass === value }
|
236
|
+
value
|
237
|
+
else
|
238
|
+
value.dup
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def __push(key,value)
|
243
|
+
unless singleton_class.method_defined? key
|
244
|
+
define_singleton_method(key) { self[key] }
|
245
|
+
define_singleton_method("#{key}=") { |val| @lookup[key] = val }
|
246
|
+
end
|
247
|
+
@lookup[key] = value
|
248
|
+
end
|
249
|
+
|
250
|
+
def __remove(key)
|
251
|
+
@lookup.delete(key)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|