├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.md ├── Rakefile ├── bin ├── console └── setup ├── debug_helper.gemspec ├── lib ├── debug_helper.rb └── debug_helper │ ├── array_handler.rb │ ├── dir_handler.rb │ ├── each_pair_handler.rb │ ├── each_with_index_handler.rb │ ├── exception_handler.rb │ ├── file_handler.rb │ ├── generic_handler.rb │ ├── handler.rb │ ├── hash_handler.rb │ ├── io_handler.rb │ ├── match_data_handler.rb │ ├── method_handler.rb │ ├── object_handler.rb │ ├── open_struct_handler.rb │ ├── range_handler.rb │ ├── regexp_handler.rb │ ├── set_handler.rb │ ├── string_handler.rb │ ├── struct_handler.rb │ ├── symbol_handler.rb │ └── version.rb ├── markdown └── readme │ ├── Rakefile │ ├── class_inclusions.md │ ├── class_links.md │ ├── classes │ ├── array │ │ ├── circular │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── mixed │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── nested │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── custom │ │ ├── both │ │ │ ├── foo.rb │ │ │ ├── foo_handler.rb │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── instance │ │ │ ├── foo.rb │ │ │ ├── foo_handler.rb │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── singleton │ │ │ ├── foo.rb │ │ │ ├── foo_handler.rb │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── dir │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── exception │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── file │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── hash │ │ ├── circular │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── mixed │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── nested │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── io │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── match_data │ │ ├── multiple_captures │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── named_captures │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── method │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── object │ │ ├── object │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── open_struct │ │ ├── circular │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── mixed │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── nested │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── range │ │ ├── exclude_end │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── include_end │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── regexp │ │ ├── named_captures │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── set │ │ ├── circular │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── mixed │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── nested │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── string │ │ ├── multiline │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── struct │ │ ├── circular │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── mixed │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── nested │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ ├── symbol │ │ ├── simple │ │ │ ├── show.md │ │ │ ├── show.rb │ │ │ ├── show.yaml │ │ │ └── template.md │ │ └── template.md │ └── template.md │ ├── options │ └── depth │ │ ├── show.md │ │ ├── show.rb │ │ ├── show.yaml │ │ └── template.md │ ├── show_array.rb │ ├── show_hash.rb │ └── template.md └── test ├── debug_helper_test.rb ├── show ├── actual │ ├── test_array.txt │ ├── test_array_circular.txt │ ├── test_array_empty.txt │ ├── test_array_mixed_values.txt │ ├── test_array_self_referencing.txt │ ├── test_array_sub.txt │ ├── test_depth_1.txt │ ├── test_depth_default.txt │ ├── test_depth_prune.txt │ ├── test_dir.txt │ ├── test_dir_sub.txt │ ├── test_exception.txt │ ├── test_exception_sub.txt │ ├── test_file.txt │ ├── test_file_sub.txt │ ├── test_hash.txt │ ├── test_hash_circular_key.txt │ ├── test_hash_circular_value.txt │ ├── test_hash_empty.txt │ ├── test_hash_mixed_keys.txt │ ├── test_hash_mixed_values.txt │ ├── test_hash_self_referencing_key.txt │ ├── test_hash_self_referencing_value.txt │ ├── test_hash_sub.txt │ ├── test_io.txt │ ├── test_io_sub.txt │ ├── test_match_data.txt │ ├── test_method.txt │ ├── test_object.txt │ ├── test_ostruct.txt │ ├── test_ostruct_circular.txt │ ├── test_ostruct_empty.txt │ ├── test_ostruct_mixed_values.txt │ ├── test_ostruct_self_referencing.txt │ ├── test_ostruct_sub.txt │ ├── test_range_exclude_end.txt │ ├── test_range_include_end.txt │ ├── test_range_sub.txt │ ├── test_regexp.txt │ ├── test_set.txt │ ├── test_set_circular.txt │ ├── test_set_empty.txt │ ├── test_set_mixed_values.txt │ ├── test_set_self_referencing.txt │ ├── test_set_sub.txt │ ├── test_string.txt │ ├── test_string_empty.txt │ ├── test_string_iso_8859.txt │ ├── test_string_multiline.txt │ ├── test_string_sub.txt │ ├── test_struct.txt │ ├── test_struct_circular.txt │ ├── test_struct_self_referencing.txt │ ├── test_struct_sub.txt │ └── test_symbol.txt └── expected │ ├── test_array.txt │ ├── test_array_circular.txt │ ├── test_array_empty.txt │ ├── test_array_mixed_values.txt │ ├── test_array_self_referencing.txt │ ├── test_array_sub.txt │ ├── test_depth_1.txt │ ├── test_depth_default.txt │ ├── test_depth_prune.txt │ ├── test_dir.txt │ ├── test_dir_sub.txt │ ├── test_exception.txt │ ├── test_exception_sub.txt │ ├── test_file.txt │ ├── test_file_sub.txt │ ├── test_hash.txt │ ├── test_hash_circular_key.txt │ ├── test_hash_circular_value.txt │ ├── test_hash_empty.txt │ ├── test_hash_mixed_keys.txt │ ├── test_hash_mixed_values.txt │ ├── test_hash_self_referencing_key.txt │ ├── test_hash_self_referencing_value.txt │ ├── test_hash_sub.txt │ ├── test_io.txt │ ├── test_io_sub.txt │ ├── test_match_data.txt │ ├── test_method.txt │ ├── test_object.txt │ ├── test_ostruct.txt │ ├── test_ostruct_circular.txt │ ├── test_ostruct_empty.txt │ ├── test_ostruct_mixed_values.txt │ ├── test_ostruct_self_referencing.txt │ ├── test_ostruct_sub.txt │ ├── test_range_exclude_end.txt │ ├── test_range_include_end.txt │ ├── test_range_sub.txt │ ├── test_regexp.txt │ ├── test_set.txt │ ├── test_set_circular.txt │ ├── test_set_empty.txt │ ├── test_set_mixed_values.txt │ ├── test_set_self_referencing.txt │ ├── test_set_sub.txt │ ├── test_string.txt │ ├── test_string_empty.txt │ ├── test_string_iso_8859.txt │ ├── test_string_multiline.txt │ ├── test_string_sub.txt │ ├── test_struct.txt │ ├── test_struct_circular.txt │ ├── test_struct_self_referencing.txt │ ├── test_struct_sub.txt │ └── test_symbol.txt ├── show_hash ├── actual │ ├── empty.txt │ ├── int_keys.txt │ ├── nil_values.txt │ ├── string_values.txt │ └── symbol_values.txt └── expected │ ├── empty.txt │ ├── int_keys.txt │ ├── nil_values.txt │ ├── string_values.txt │ └── symbol_values.txt └── test_helper.rb /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /_yardoc/ 4 | /.idea/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: ruby 3 | rvm: 4 | - 2.2.6 5 | before_install: gem install bundler -v 1.16.2 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at burdettelamar@yahoo.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 4 | 5 | # Specify your gem's dependencies in debug_helper.gemspec 6 | gemspec 7 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | debug_helper (2.1.0) 5 | 6 | GEM 7 | remote: https://rubygems.org/ 8 | specs: 9 | diff-lcs (1.3) 10 | minitest (5.11.3) 11 | rake (10.5.0) 12 | 13 | PLATFORMS 14 | x64-mingw32 15 | 16 | DEPENDENCIES 17 | bundler (~> 1.16) 18 | debug_helper! 19 | diff-lcs (~> 1.3) 20 | minitest (~> 5.0) 21 | rake (~> 10.0) 22 | 23 | BUNDLED WITH 24 | 1.16.2 25 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 burdettelamar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "rake/testtask" 3 | 4 | Rake::TestTask.new(:test) do |t| 5 | t.libs << "test" 6 | t.libs << "lib" 7 | t.test_files = FileList["test/**/*_test.rb"] 8 | end 9 | 10 | task :default => :test 11 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "debug_helper" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start(__FILE__) 15 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /debug_helper.gemspec: -------------------------------------------------------------------------------- 1 | 2 | lib = File.expand_path("../lib", __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require "debug_helper/version" 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "debug_helper" 8 | spec.version = DebugHelper::VERSION 9 | spec.authors = ["burdettelamar"] 10 | spec.email = ["burdettelamar@yahoo.com"] 11 | 12 | spec.summary = %q{Help for printf-style debugging.} 13 | spec.homepage = "https://github.com/BurdetteLamar/debug_helper" 14 | spec.license = "MIT" 15 | 16 | # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' 17 | # to allow pushing to a single host or delete this section to allow pushing to any host. 18 | # if spec.respond_to?(:metadata) 19 | # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" 20 | # else 21 | # raise "RubyGems 2.0 or newer is required to protect against " \ 22 | # "public gem pushes." 23 | # end 24 | 25 | # Specify which files should be added to the gem when it is released. 26 | # The `git ls-files -z` loads the files in the RubyGem that have been added into git. 27 | spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do 28 | `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 29 | end 30 | spec.bindir = "bin" 31 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 32 | spec.require_paths = ["lib"] 33 | 34 | spec.add_development_dependency "bundler", "~> 1.16" 35 | spec.add_development_dependency "rake", "~> 10.0" 36 | spec.add_development_dependency "minitest", "~> 5.0" 37 | spec.add_development_dependency "diff-lcs", "~> 1.3" 38 | end 39 | -------------------------------------------------------------------------------- /lib/debug_helper.rb: -------------------------------------------------------------------------------- 1 | require 'ostruct' 2 | require 'set' 3 | require 'yaml' 4 | 5 | require_relative 'debug_helper/version' 6 | 7 | require_relative 'debug_helper/handler' 8 | 9 | require_relative 'debug_helper/each_with_index_handler' 10 | require_relative 'debug_helper/array_handler' 11 | require_relative 'debug_helper/set_handler' 12 | 13 | require_relative 'debug_helper/each_pair_handler' 14 | require_relative 'debug_helper/hash_handler' 15 | require_relative 'debug_helper/struct_handler' 16 | 17 | require_relative 'debug_helper/dir_handler' 18 | require_relative 'debug_helper/exception_handler' 19 | require_relative 'debug_helper/file_handler' 20 | require_relative 'debug_helper/generic_handler' 21 | require_relative 'debug_helper/io_handler' 22 | require_relative 'debug_helper/match_data_handler' 23 | require_relative 'debug_helper/method_handler' 24 | require_relative 'debug_helper/object_handler' 25 | require_relative 'debug_helper/open_struct_handler' 26 | require_relative 'debug_helper/regexp_handler' 27 | require_relative 'debug_helper/string_handler' 28 | require_relative 'debug_helper/symbol_handler' 29 | require_relative 'debug_helper/range_handler' 30 | 31 | class DebugHelper 32 | 33 | module Putd 34 | 35 | def putd(obj, message, options = {}) 36 | DebugHelper.show(obj, message, options) 37 | end 38 | 39 | end 40 | 41 | attr_accessor \ 42 | :obj, 43 | :message, 44 | :object_ids, 45 | :depth 46 | 47 | def self.show(obj, message = obj.class, options = {}) 48 | debug_helper = DebugHelper.new(obj, message, options) 49 | s = debug_helper.show(obj, message, info = {}) 50 | puts s.to_yaml 51 | end 52 | 53 | def initialize(obj, message, options) 54 | self.obj = obj 55 | self.message = message 56 | self.depth = options[:depth] || 3 57 | self.object_ids = [] 58 | end 59 | 60 | def object_seen?(obj) 61 | object_ids.include?(obj.object_id) 62 | end 63 | 64 | def depth_reached? 65 | depth == object_ids.size 66 | end 67 | 68 | def show(obj, message, info) 69 | handler = nil 70 | if object_seen?(obj) || depth_reached? 71 | handler = GenericHandler.new(self, obj, message, info) 72 | s = handler.show 73 | else 74 | object_ids.push(obj.object_id) 75 | begin 76 | # If there's a handler for the class, use it. 77 | # Note that the class may be a custom class, not defined here, 78 | # but instead defined outside this project. 79 | # So if the user of this library has defined DebugHelper::FooHandler 80 | # and the object is a Foo, that handler will be selected and called. 81 | handler_class_name = "DebugHelper::#{obj.class.name}Handler" 82 | handler_class = Object.const_get(handler_class_name) 83 | handler = handler_class.new(method(__method__), obj, message, info) 84 | rescue 85 | # If there's not a handler for the class, try using :kind_of?. 86 | [ 87 | Array, 88 | Dir, 89 | Exception, 90 | File, 91 | IO, 92 | Hash, 93 | OpenStruct, 94 | Range, 95 | Set, 96 | String, 97 | Struct, 98 | # There's no method Symbol.new, so cannot instantiate a subclass. 99 | # Symbol, 100 | ].each do |klass| 101 | if obj.kind_of?(klass) 102 | handler_class_name = "DebugHelper::#{klass.name}Handler" 103 | handler_class = Object.const_get(handler_class_name) 104 | handler = handler_class.new(method(__method__), obj, message, info) 105 | break 106 | end 107 | end 108 | end 109 | if handler.nil? 110 | if obj.instance_of?(Object) 111 | handler_class= ObjectHandler 112 | else 113 | handler_class = GenericHandler 114 | end 115 | handler = handler_class.new(self, obj, message, info) 116 | end 117 | s = handler.show 118 | object_ids.pop 119 | end 120 | s 121 | end 122 | 123 | end 124 | -------------------------------------------------------------------------------- /lib/debug_helper/array_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class ArrayHandler < EachWithIndexHandler 4 | 5 | def calls_for_instance 6 | [ 7 | [:size], 8 | ] 9 | end 10 | 11 | end 12 | end -------------------------------------------------------------------------------- /lib/debug_helper/dir_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class DirHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:path], 8 | ] 9 | end 10 | 11 | def calls_for_class 12 | [ 13 | [:entries, obj.path], 14 | [:exist?, obj.path], 15 | ] 16 | end 17 | 18 | end 19 | end -------------------------------------------------------------------------------- /lib/debug_helper/each_pair_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class EachPairHandler < Handler 4 | 5 | attr_accessor :pair_names 6 | 7 | def each_pair? 8 | true 9 | end 10 | 11 | end 12 | 13 | end -------------------------------------------------------------------------------- /lib/debug_helper/each_with_index_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class EachWithIndexHandler < Handler 4 | 5 | def each_with_index? 6 | true 7 | end 8 | 9 | end 10 | 11 | end -------------------------------------------------------------------------------- /lib/debug_helper/exception_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class ExceptionHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:message], 8 | [:cause], 9 | [:backtrace], 10 | ] 11 | end 12 | end 13 | 14 | end -------------------------------------------------------------------------------- /lib/debug_helper/file_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class FileHandler < Handler 4 | 5 | def calls_for_class 6 | path = obj.path 7 | [ 8 | [:absolute_path, path], 9 | [:atime, path], 10 | [:ctime, path], 11 | [:executable?, path], 12 | [:exist?, path], 13 | [:ftype, path], 14 | [:mtime, path], 15 | [:path, path], 16 | [:pipe?, path], 17 | [:readable?, path], 18 | [:realpath, path], 19 | [:setgid?, path], 20 | [:setuid?, path], 21 | [:size, path], 22 | [:socket?, path], 23 | [:symlink?, path], 24 | [:writable?, path], 25 | ] 26 | end 27 | end 28 | 29 | end -------------------------------------------------------------------------------- /lib/debug_helper/generic_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class GenericHandler < Handler 4 | 5 | def show 6 | message_info = message.nil? ? '' : " (message='#{message}')" 7 | "#{obj.class.name}#{message_info} #{obj.inspect}" 8 | end 9 | 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /lib/debug_helper/handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class Handler 4 | 5 | attr_accessor :show_method, :obj, :message, :info, :attrs, :content 6 | 7 | def initialize(show_method, obj, message, info) 8 | self.show_method = show_method 9 | self.obj = obj 10 | self.message = message 11 | self.info = info 12 | self.attrs = {} 13 | self.content = {} 14 | show 15 | end 16 | 17 | def show 18 | gather 19 | finish 20 | end 21 | 22 | def gather 23 | calls_for_instance.each do |call_info| 24 | method = call_info.shift 25 | unless obj.respond_to?(method) 26 | message = "Instance of #{obj.class} does not respond to method #{method}" 27 | raise NoMethodError.new(message, method) 28 | end 29 | args = call_info 30 | if args.empty? 31 | value = obj.send(method) 32 | key = "#{obj.class.name}##{method.to_s}" 33 | else 34 | value = obj.send(method, *args) 35 | arglist = args.collect {|arg| arg.inspect}.join(', ') 36 | key = "#{obj.class.name}##{method.to_s}(#{arglist})" 37 | end 38 | content.store(key, value) 39 | end 40 | calls_for_class.each do |call_info| 41 | klass = Object.const_get(obj.class.name) 42 | method = call_info.shift 43 | unless klass.respond_to?(method) 44 | message = "#{obj.class} does not respond to method #{method}" 45 | raise NoMethodError.new(message, method) 46 | end 47 | args = call_info 48 | if args.empty? 49 | value = klass.send(method) 50 | key = "#{klass}.#{method.to_s}" 51 | else 52 | value = klass.send(method, *args) 53 | arglist = args.collect {|arg| arg.inspect}.join(', ') 54 | key = "#{klass}.#{method.to_s}(#{arglist})" 55 | end 56 | content.store(key, value) 57 | end 58 | if each_with_index? 59 | obj.each_with_index do |item, i| 60 | self.content.store("Element #{i}", show_method.call(item, nil, {})) 61 | end 62 | end 63 | if each_pair? 64 | pair_name, key_name, value_name = *pair_names 65 | i = 0 66 | obj.each_pair do |key, value| 67 | pair = {key_name => show_method.call(key, nil, {}), value_name => show_method.call(value, nil, {})} 68 | self.content.store("#{pair_name} #{i}", pair) 69 | i += 1 70 | end 71 | end 72 | end 73 | 74 | def finish 75 | attrs[:message] = "'#{message}'" unless message.nil? 76 | self.info.store(label, content) 77 | info 78 | end 79 | 80 | def label 81 | a = [] 82 | attrs.each_pair do |key, value| 83 | a.push("#{key}=#{value}") unless value.nil? 84 | end 85 | return self.obj.class.name if a.empty? 86 | attrs_s = a.join(' ') 87 | "#{self.obj.class.name} (#{attrs_s})" 88 | end 89 | 90 | def calls_for_instance 91 | [] 92 | end 93 | 94 | def calls_for_class 95 | [] 96 | end 97 | 98 | def each_with_index? 99 | false 100 | end 101 | 102 | def each_pair? 103 | false 104 | end 105 | 106 | end 107 | 108 | end -------------------------------------------------------------------------------- /lib/debug_helper/hash_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class HashHandler < EachPairHandler 4 | 5 | def calls_for_instance 6 | [ 7 | [:size], 8 | [:default], 9 | [:default_proc], 10 | ] 11 | end 12 | def show 13 | self.pair_names = %w/Pair Key Value/ 14 | super 15 | end 16 | 17 | end 18 | 19 | end -------------------------------------------------------------------------------- /lib/debug_helper/io_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class IOHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:autoclose?], 8 | [:binmode?], 9 | [:closed?], 10 | [:tty?], 11 | ] 12 | end 13 | end 14 | 15 | end -------------------------------------------------------------------------------- /lib/debug_helper/match_data_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class MatchDataHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:size], 8 | [:regexp], 9 | [:to_a], 10 | [:captures], 11 | [:names], 12 | ] 13 | end 14 | 15 | end 16 | 17 | end -------------------------------------------------------------------------------- /lib/debug_helper/method_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class MethodHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:arity], 8 | [:inspect], 9 | [:name], 10 | [:original_name], 11 | [:owner], 12 | [:parameters], 13 | [:source_location], 14 | [:super_method], 15 | ] 16 | end 17 | 18 | end 19 | 20 | end -------------------------------------------------------------------------------- /lib/debug_helper/object_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class ObjectHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:object_id], 8 | ] 9 | end 10 | 11 | end 12 | 13 | end -------------------------------------------------------------------------------- /lib/debug_helper/open_struct_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class OpenStructHandler < EachPairHandler 4 | 5 | def show 6 | self.pair_names = %w/Member Name Value/ 7 | super 8 | end 9 | 10 | def each_pair? 11 | true 12 | end 13 | 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /lib/debug_helper/range_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class RangeHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:first], 8 | [:last], 9 | [:exclude_end?], 10 | ] 11 | end 12 | 13 | end 14 | end -------------------------------------------------------------------------------- /lib/debug_helper/regexp_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class RegexpHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:to_s], 8 | [:casefold?], 9 | [:named_captures], 10 | [:encoding], 11 | [:fixed_encoding?], 12 | ] 13 | end 14 | 15 | end 16 | end -------------------------------------------------------------------------------- /lib/debug_helper/set_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class SetHandler < EachWithIndexHandler 4 | 5 | def calls_for_instance 6 | [ 7 | [:size], 8 | ] 9 | end 10 | 11 | end 12 | end -------------------------------------------------------------------------------- /lib/debug_helper/string_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class StringHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:to_s], 8 | [:size], 9 | [:encoding], 10 | [:ascii_only?], 11 | [:bytesize], 12 | ] 13 | end 14 | 15 | end 16 | 17 | end -------------------------------------------------------------------------------- /lib/debug_helper/struct_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class StructHandler < EachPairHandler 4 | 5 | def calls_for_instance 6 | [ 7 | [:size], 8 | ] 9 | end 10 | 11 | def show 12 | self.pair_names = %w/Member Name Value/ 13 | super 14 | end 15 | 16 | end 17 | 18 | end -------------------------------------------------------------------------------- /lib/debug_helper/symbol_handler.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | 3 | class SymbolHandler < Handler 4 | 5 | def calls_for_instance 6 | [ 7 | [:to_s], 8 | [:size], 9 | [:encoding], 10 | ] 11 | end 12 | 13 | end 14 | 15 | end -------------------------------------------------------------------------------- /lib/debug_helper/version.rb: -------------------------------------------------------------------------------- 1 | class DebugHelper 2 | VERSION = "2.1.0" 3 | end 4 | -------------------------------------------------------------------------------- /markdown/readme/Rakefile: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | require 'markdown_helper' 3 | 4 | namespace :build do 5 | 6 | desc 'Build README.md' 7 | task :readme do 8 | # Make output files. 9 | Dir.chdir('options/depth') do 10 | command = 'ruby show.rb > show.yaml' 11 | system(command) 12 | command = 'markdown_helper include --pristine template.md show.md' 13 | system(command) 14 | end 15 | class_dir_names = nil 16 | Dir.chdir('classes') do 17 | class_names = %w/ 18 | Array 19 | Dir 20 | Exception 21 | File 22 | Hash 23 | IO 24 | MatchData 25 | Method 26 | OpenStruct 27 | Range 28 | Regexp 29 | Set 30 | String 31 | Struct 32 | Symbol 33 | Object 34 | Custom 35 | / 36 | class_dir_names = [] 37 | correct_dir_names = { 38 | :IO => 'io', 39 | :MatchData => 'match_data', 40 | :OpenStruct => 'open_struct', 41 | } 42 | class_names.each do |class_name| 43 | if correct_dir_names.include?(class_name.to_sym) 44 | class_dir_name = correct_dir_names.fetch(class_name.to_sym) 45 | else 46 | class_dir_name = class_name.downcase 47 | end 48 | class_dir_names.push(class_dir_name) 49 | end 50 | class_dir_names.each do |class_dir_name| 51 | Dir.chdir(class_dir_name) do 52 | case_dir_names = Dir.glob('*').select {|f| File.directory? f} 53 | case_dir_names.each do |case_dir_name| 54 | Dir.chdir(case_dir_name) do 55 | command = 'ruby show.rb > show.yaml' 56 | system(command) 57 | command = 'markdown_helper include --pristine template.md show.md' 58 | system(command) 59 | end 60 | end 61 | end 62 | end 63 | end 64 | # Make list of links to class sections. 65 | File.open('class_links.md', 'w') do |file| 66 | correct_class_names = { 67 | :io => 'IO', 68 | :match_data => 'MatchData', 69 | :open_struct => 'OpenStruct', 70 | } 71 | class_dir_names.each do |class_dir_name| 72 | next if %w/object custom/.include?(class_dir_name) 73 | if correct_class_names.include?(class_dir_name.to_sym) 74 | class_name = correct_class_names.fetch(class_dir_name.to_sym) 75 | else 76 | class_name = class_dir_name.capitalize 77 | end 78 | link_line = "- [#{class_name}](##{class_name.downcase})" 79 | file.puts(link_line) 80 | end 81 | end 82 | # Make inclusions for class sections. 83 | File.open('class_inclusions.md', 'w') do |file| 84 | class_dir_names.each do |class_name| 85 | inclusion_line = "@[:markdown](classes/#{class_name}/template.md)" 86 | file.puts(inclusion_line) 87 | end 88 | end 89 | # Make the README markdown. 90 | command = "markdown_helper include --pristine template.md ../../README.md" 91 | system(command) 92 | end 93 | end -------------------------------------------------------------------------------- /markdown/readme/class_inclusions.md: -------------------------------------------------------------------------------- 1 | @[:markdown](classes/array/template.md) 2 | @[:markdown](classes/dir/template.md) 3 | @[:markdown](classes/exception/template.md) 4 | @[:markdown](classes/file/template.md) 5 | @[:markdown](classes/hash/template.md) 6 | @[:markdown](classes/io/template.md) 7 | @[:markdown](classes/match_data/template.md) 8 | @[:markdown](classes/method/template.md) 9 | @[:markdown](classes/open_struct/template.md) 10 | @[:markdown](classes/range/template.md) 11 | @[:markdown](classes/regexp/template.md) 12 | @[:markdown](classes/set/template.md) 13 | @[:markdown](classes/string/template.md) 14 | @[:markdown](classes/struct/template.md) 15 | @[:markdown](classes/symbol/template.md) 16 | @[:markdown](classes/object/template.md) 17 | @[:markdown](classes/custom/template.md) 18 | -------------------------------------------------------------------------------- /markdown/readme/class_links.md: -------------------------------------------------------------------------------- 1 | - [Array](#array) 2 | - [Dir](#dir) 3 | - [Exception](#exception) 4 | - [File](#file) 5 | - [Hash](#hash) 6 | - [IO](#io) 7 | - [MatchData](#matchdata) 8 | - [Method](#method) 9 | - [OpenStruct](#openstruct) 10 | - [Range](#range) 11 | - [Regexp](#regexp) 12 | - [Set](#set) 13 | - [String](#string) 14 | - [Struct](#struct) 15 | - [Symbol](#symbol) 16 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/circular/show.md: -------------------------------------------------------------------------------- 1 | #### Circular Arrays 2 | 3 | This example shows arrays that make a circular reference. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | ary_0 = [] 10 | ary_1 = [] 11 | ary_0.push(ary_1) 12 | ary_1.push(ary_0) 13 | DebugHelper.show(ary_0, 'My circular arrays') 14 | ``` 15 | 16 | The output shows details of the arrays. 17 | 18 | The circular reference is not followed. 19 | 20 | ```show.yaml```: 21 | ```yaml 22 | --- 23 | Array (message='My circular arrays'): 24 | Array#size: 1 25 | Element 0: 26 | Array: 27 | Array#size: 1 28 | Element 0: Array [[[...]]] 29 | ``` 30 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/circular/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | ary_0 = [] 4 | ary_1 = [] 5 | ary_0.push(ary_1) 6 | ary_1.push(ary_0) 7 | DebugHelper.show(ary_0, 'My circular arrays') 8 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/circular/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='My circular arrays'): 3 | Array#size: 1 4 | Element 0: 5 | Array: 6 | Array#size: 1 7 | Element 0: Array [[[...]]] 8 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/circular/template.md: -------------------------------------------------------------------------------- 1 | #### Circular Arrays 2 | 3 | This example shows arrays that make a circular reference. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the arrays. 8 | 9 | The circular reference is not followed. 10 | 11 | @[yaml](show.yaml) 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/mixed/show.md: -------------------------------------------------------------------------------- 1 | #### Mixed Array 2 | 3 | This example shows an array of mixed values. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | ary = [0, 'one', :two] 10 | DebugHelper.show(ary, 'My mixed array') 11 | ``` 12 | 13 | The output shows details of the array. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Array (message='My mixed array'): 19 | Array#size: 3 20 | Element 0: Integer 0 21 | Element 1: 22 | String: 23 | String#to_s: one 24 | String#size: 3 25 | String#encoding: !ruby/encoding UTF-8 26 | String#ascii_only?: true 27 | String#bytesize: 3 28 | Element 2: 29 | Symbol: 30 | Symbol#to_s: two 31 | Symbol#size: 3 32 | Symbol#encoding: !ruby/encoding US-ASCII 33 | ``` 34 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/mixed/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | ary = [0, 'one', :two] 4 | DebugHelper.show(ary, 'My mixed array') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/mixed/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='My mixed array'): 3 | Array#size: 3 4 | Element 0: Integer 0 5 | Element 1: 6 | String: 7 | String#to_s: one 8 | String#size: 3 9 | String#encoding: !ruby/encoding UTF-8 10 | String#ascii_only?: true 11 | String#bytesize: 3 12 | Element 2: 13 | Symbol: 14 | Symbol#to_s: two 15 | Symbol#size: 3 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/mixed/template.md: -------------------------------------------------------------------------------- 1 | #### Mixed Array 2 | 3 | This example shows an array of mixed values. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the array. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/nested/show.md: -------------------------------------------------------------------------------- 1 | #### Nested Arrays 2 | 3 | This example shows nested arrays. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | ary = [0, [1, 2], [3, 4]] 10 | DebugHelper.show(ary, 'My nested arrays') 11 | ``` 12 | 13 | The output shows details of the arrays. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Array (message='My nested arrays'): 19 | Array#size: 3 20 | Element 0: Integer 0 21 | Element 1: 22 | Array: 23 | Array#size: 2 24 | Element 0: Integer 1 25 | Element 1: Integer 2 26 | Element 2: 27 | Array: 28 | Array#size: 2 29 | Element 0: Integer 3 30 | Element 1: Integer 4 31 | ``` 32 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/nested/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | ary = [0, [1, 2], [3, 4]] 4 | DebugHelper.show(ary, 'My nested arrays') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/nested/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='My nested arrays'): 3 | Array#size: 3 4 | Element 0: Integer 0 5 | Element 1: 6 | Array: 7 | Array#size: 2 8 | Element 0: Integer 1 9 | Element 1: Integer 2 10 | Element 2: 11 | Array: 12 | Array#size: 2 13 | Element 0: Integer 3 14 | Element 1: Integer 4 15 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/nested/template.md: -------------------------------------------------------------------------------- 1 | #### Nested Arrays 2 | 3 | This example shows nested arrays. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the arrays. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Array 2 | 3 | This example shows a simple array of integers. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | ary = [5, 10, 15] 10 | DebugHelper.show(ary, 'My simple array') 11 | ``` 12 | 13 | The output shows details of the array. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Array (message='My simple array'): 19 | Array#size: 3 20 | Element 0: Integer 5 21 | Element 1: Integer 10 22 | Element 2: Integer 15 23 | ``` 24 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | ary = [5, 10, 15] 4 | DebugHelper.show(ary, 'My simple array') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='My simple array'): 3 | Array#size: 3 4 | Element 0: Integer 5 5 | Element 1: Integer 10 6 | Element 2: Integer 15 7 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Array 2 | 3 | This example shows a simple array of integers. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the array. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/array/template.md: -------------------------------------------------------------------------------- 1 | ### Array 2 | 3 | @[:markdown](simple/show.md) 4 | 5 | @[:markdown](mixed/show.md) 6 | 7 | @[:markdown](nested/show.md) 8 | 9 | @[:markdown](circular/show.md) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/both/foo.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | class Foo 4 | 5 | def my_array 6 | %w/foo bar baz/ 7 | end 8 | 9 | def my_hash 10 | {:a => 0, :b => 1} 11 | end 12 | 13 | def self.my_array 14 | %w/bat bam bad/ 15 | end 16 | 17 | def self.my_hash 18 | {:c => 2, :d => 3} 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/both/foo_handler.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | class DebugHelper 4 | 5 | class FooHandler < Handler 6 | 7 | def calls_for_instance 8 | [ 9 | [:my_array], 10 | [:my_hash], 11 | [:respond_to?, :your_array], 12 | [:respond_to?, :your_hash], 13 | ] 14 | end 15 | 16 | def calls_for_class 17 | [ 18 | [:my_array], 19 | [:my_hash], 20 | [:respond_to?, :your_array], 21 | [:respond_to?, :your_hash], 22 | ] 23 | end 24 | 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/both/show.md: -------------------------------------------------------------------------------- 1 | #### Instance and Singleton Methods 2 | 3 | This example shows a custom handler that explicates via both kinds of methods. 4 | 5 | Here's a class ```Foo``` that has instance methods and singleton methods: 6 | 7 | ```foo.rb```: 8 | ```ruby 9 | require 'debug_helper' 10 | 11 | class Foo 12 | 13 | def my_array 14 | %w/foo bar baz/ 15 | end 16 | 17 | def my_hash 18 | {:a => 0, :b => 1} 19 | end 20 | 21 | def self.my_array 22 | %w/bat bam bad/ 23 | end 24 | 25 | def self.my_hash 26 | {:c => 2, :d => 3} 27 | end 28 | 29 | end 30 | ``` 31 | 32 | Here's its custom debug handler class ```FooHandler```. 33 | 34 | ```foo_handler.rb```: 35 | ```ruby 36 | require 'debug_helper' 37 | 38 | class DebugHelper 39 | 40 | class FooHandler < Handler 41 | 42 | def calls_for_instance 43 | [ 44 | [:my_array], 45 | [:my_hash], 46 | [:respond_to?, :your_array], 47 | [:respond_to?, :your_hash], 48 | ] 49 | end 50 | 51 | def calls_for_class 52 | [ 53 | [:my_array], 54 | [:my_hash], 55 | [:respond_to?, :your_array], 56 | [:respond_to?, :your_hash], 57 | ] 58 | end 59 | 60 | end 61 | 62 | end 63 | ``` 64 | 65 | Here's a program that uses the custom handler. 66 | 67 | ```show.rb```: 68 | ```ruby 69 | require 'debug_helper' 70 | require_relative 'foo' 71 | require_relative 'foo_handler' 72 | 73 | DebugHelper.show(Foo.new, 'My class Foo') 74 | ``` 75 | 76 | The output shows details of the object. 77 | 78 | ```show.yaml```: 79 | ```yaml 80 | --- 81 | Foo (message='My class Foo'): 82 | Foo#my_array: 83 | - foo 84 | - bar 85 | - baz 86 | Foo#my_hash: 87 | :a: 0 88 | :b: 1 89 | Foo#respond_to?(:your_array): false 90 | Foo#respond_to?(:your_hash): false 91 | Foo.my_array: 92 | - bat 93 | - bam 94 | - bad 95 | Foo.my_hash: 96 | :c: 2 97 | :d: 3 98 | Foo.respond_to?(:your_array): false 99 | Foo.respond_to?(:your_hash): false 100 | ``` 101 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/both/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | require_relative 'foo' 3 | require_relative 'foo_handler' 4 | 5 | DebugHelper.show(Foo.new, 'My class Foo') 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/both/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Foo (message='My class Foo'): 3 | Foo#my_array: 4 | - foo 5 | - bar 6 | - baz 7 | Foo#my_hash: 8 | :a: 0 9 | :b: 1 10 | Foo#respond_to?(:your_array): false 11 | Foo#respond_to?(:your_hash): false 12 | Foo.my_array: 13 | - bat 14 | - bam 15 | - bad 16 | Foo.my_hash: 17 | :c: 2 18 | :d: 3 19 | Foo.respond_to?(:your_array): false 20 | Foo.respond_to?(:your_hash): false 21 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/both/template.md: -------------------------------------------------------------------------------- 1 | #### Instance and Singleton Methods 2 | 3 | This example shows a custom handler that explicates via both kinds of methods. 4 | 5 | Here's a class ```Foo``` that has instance methods and singleton methods: 6 | 7 | @[ruby](foo.rb) 8 | 9 | Here's its custom debug handler class ```FooHandler```. 10 | 11 | @[ruby](foo_handler.rb) 12 | 13 | Here's a program that uses the custom handler. 14 | 15 | @[ruby](show.rb) 16 | 17 | The output shows details of the object. 18 | 19 | @[yaml](show.yaml) 20 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/instance/foo.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | class Foo 4 | 5 | def my_array 6 | %w/foo bar baz/ 7 | end 8 | 9 | def my_hash 10 | {:a => 0, :b => 1} 11 | end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/instance/foo_handler.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | class DebugHelper 4 | 5 | class FooHandler < Handler 6 | 7 | def calls_for_instance 8 | [ 9 | [:my_array], 10 | [:my_hash], 11 | [:respond_to?, :your_array], 12 | [:respond_to?, :your_hash], 13 | ] 14 | end 15 | 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/instance/show.md: -------------------------------------------------------------------------------- 1 | #### Instance Methods 2 | 3 | This example shows a custom handler that explicates via instance methods. 4 | 5 | Here's a class ```Foo``` that has some instance methods: 6 | 7 | ```foo.rb```: 8 | ```ruby 9 | require 'debug_helper' 10 | 11 | class Foo 12 | 13 | def my_array 14 | %w/foo bar baz/ 15 | end 16 | 17 | def my_hash 18 | {:a => 0, :b => 1} 19 | end 20 | 21 | end 22 | ``` 23 | 24 | Here's its custom debug handler class ```FooHandler```. The array returned by method ```calls_for_instance``` tells the base class ```Handler``` which methods to call for the explication, and what arguments to pass, if any. 25 | 26 | ```foo_handler.rb```: 27 | ```ruby 28 | require 'debug_helper' 29 | 30 | class DebugHelper 31 | 32 | class FooHandler < Handler 33 | 34 | def calls_for_instance 35 | [ 36 | [:my_array], 37 | [:my_hash], 38 | [:respond_to?, :your_array], 39 | [:respond_to?, :your_hash], 40 | ] 41 | end 42 | 43 | end 44 | 45 | end 46 | ``` 47 | 48 | Here's a program that uses the custom handler. 49 | 50 | ```show.rb```: 51 | ```ruby 52 | require 'debug_helper' 53 | require_relative 'foo' 54 | require_relative 'foo_handler' 55 | 56 | DebugHelper.show(Foo.new, 'My class Foo') 57 | ``` 58 | 59 | The output shows details of the object. 60 | 61 | ```show.yaml```: 62 | ```yaml 63 | --- 64 | Foo (message='My class Foo'): 65 | Foo#my_array: 66 | - foo 67 | - bar 68 | - baz 69 | Foo#my_hash: 70 | :a: 0 71 | :b: 1 72 | Foo#respond_to?(:your_array): false 73 | Foo#respond_to?(:your_hash): false 74 | ``` 75 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/instance/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | require_relative 'foo' 3 | require_relative 'foo_handler' 4 | 5 | DebugHelper.show(Foo.new, 'My class Foo') 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/instance/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Foo (message='My class Foo'): 3 | Foo#my_array: 4 | - foo 5 | - bar 6 | - baz 7 | Foo#my_hash: 8 | :a: 0 9 | :b: 1 10 | Foo#respond_to?(:your_array): false 11 | Foo#respond_to?(:your_hash): false 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/instance/template.md: -------------------------------------------------------------------------------- 1 | #### Instance Methods 2 | 3 | This example shows a custom handler that explicates via instance methods. 4 | 5 | Here's a class ```Foo``` that has some instance methods: 6 | 7 | @[ruby](foo.rb) 8 | 9 | Here's its custom debug handler class ```FooHandler```. The array returned by method ```calls_for_instance``` tells the base class ```Handler``` which methods to call for the explication, and what arguments to pass, if any. 10 | 11 | @[ruby](foo_handler.rb) 12 | 13 | Here's a program that uses the custom handler. 14 | 15 | @[ruby](show.rb) 16 | 17 | The output shows details of the object. 18 | 19 | @[yaml](show.yaml) 20 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/singleton/foo.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | class Foo 4 | 5 | def self.my_array 6 | %w/bat bam bad/ 7 | end 8 | 9 | def self.my_hash 10 | {:c => 2, :d => 3} 11 | end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/singleton/foo_handler.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | class DebugHelper 4 | 5 | class FooHandler < Handler 6 | 7 | def calls_for_class 8 | [ 9 | [:my_array], 10 | [:my_hash], 11 | [:respond_to?, :your_array], 12 | [:respond_to?, :your_hash], 13 | ] 14 | end 15 | 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/singleton/show.md: -------------------------------------------------------------------------------- 1 | #### Singleton Methods 2 | 3 | This example shows a custom handler that explicates via singleton methods. 4 | 5 | Here's a class ```Foo``` that has some singleton methods: 6 | 7 | ```foo.rb```: 8 | ```ruby 9 | require 'debug_helper' 10 | 11 | class Foo 12 | 13 | def self.my_array 14 | %w/bat bam bad/ 15 | end 16 | 17 | def self.my_hash 18 | {:c => 2, :d => 3} 19 | end 20 | 21 | end 22 | ``` 23 | 24 | Here's its custom debug handler class ```FooHandler```. The array returned in method ```calls_for_class``` tells the base class ```Handler``` which methods to call for the explication. 25 | 26 | ```foo_handler.rb```: 27 | ```ruby 28 | require 'debug_helper' 29 | 30 | class DebugHelper 31 | 32 | class FooHandler < Handler 33 | 34 | def calls_for_class 35 | [ 36 | [:my_array], 37 | [:my_hash], 38 | [:respond_to?, :your_array], 39 | [:respond_to?, :your_hash], 40 | ] 41 | end 42 | 43 | end 44 | 45 | end 46 | ``` 47 | 48 | Here's a program that uses the custom handler. 49 | 50 | ```show.rb```: 51 | ```ruby 52 | require 'debug_helper' 53 | require_relative 'foo' 54 | require_relative 'foo_handler' 55 | 56 | DebugHelper.show(Foo.new, 'My class Foo') 57 | ``` 58 | 59 | The output shows details of the object. 60 | 61 | ```show.yaml```: 62 | ```yaml 63 | --- 64 | Foo (message='My class Foo'): 65 | Foo.my_array: 66 | - bat 67 | - bam 68 | - bad 69 | Foo.my_hash: 70 | :c: 2 71 | :d: 3 72 | Foo.respond_to?(:your_array): false 73 | Foo.respond_to?(:your_hash): false 74 | ``` 75 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/singleton/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | require_relative 'foo' 3 | require_relative 'foo_handler' 4 | 5 | DebugHelper.show(Foo.new, 'My class Foo') 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/singleton/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Foo (message='My class Foo'): 3 | Foo.my_array: 4 | - bat 5 | - bam 6 | - bad 7 | Foo.my_hash: 8 | :c: 2 9 | :d: 3 10 | Foo.respond_to?(:your_array): false 11 | Foo.respond_to?(:your_hash): false 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/singleton/template.md: -------------------------------------------------------------------------------- 1 | #### Singleton Methods 2 | 3 | This example shows a custom handler that explicates via singleton methods. 4 | 5 | Here's a class ```Foo``` that has some singleton methods: 6 | 7 | @[ruby](foo.rb) 8 | 9 | Here's its custom debug handler class ```FooHandler```. The array returned in method ```calls_for_class``` tells the base class ```Handler``` which methods to call for the explication. 10 | 11 | @[ruby](foo_handler.rb) 12 | 13 | Here's a program that uses the custom handler. 14 | 15 | @[ruby](show.rb) 16 | 17 | The output shows details of the object. 18 | 19 | @[yaml](show.yaml) 20 | -------------------------------------------------------------------------------- /markdown/readme/classes/custom/template.md: -------------------------------------------------------------------------------- 1 | ### Custom 2 | 3 | You can create custom handlers for your own classes. 4 | 5 | @[:markdown](instance/show.md) 6 | 7 | @[:markdown](singleton/show.md) 8 | 9 | @[:markdown](both/show.md) 10 | 11 | -------------------------------------------------------------------------------- /markdown/readme/classes/dir/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Dir 2 | 3 | This example shows a simple ```Dir```. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | dir = Dir.new(File.dirname(__FILE__)) 10 | DebugHelper.show(dir, 'My simple dir') 11 | ``` 12 | 13 | The output shows details of the ```Dir```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Dir (message='My simple dir'): 19 | Dir#path: "." 20 | Dir.entries("."): 21 | - "." 22 | - ".." 23 | - show.md 24 | - show.rb 25 | - show.yaml 26 | - template.md 27 | Dir.exist?("."): true 28 | ``` 29 | -------------------------------------------------------------------------------- /markdown/readme/classes/dir/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | dir = Dir.new(File.dirname(__FILE__)) 4 | DebugHelper.show(dir, 'My simple dir') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/dir/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Dir (message='My simple dir'): 3 | Dir#path: "." 4 | Dir.entries("."): 5 | - "." 6 | - ".." 7 | - show.md 8 | - show.rb 9 | - show.yaml 10 | - template.md 11 | Dir.exist?("."): true 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/dir/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Dir 2 | 3 | This example shows a simple ```Dir```. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```Dir```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/dir/template.md: -------------------------------------------------------------------------------- 1 | ### Dir 2 | 3 | @[:markdown](simple/show.md) 4 | -------------------------------------------------------------------------------- /markdown/readme/classes/exception/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Exception 2 | 3 | This example shows a simple ```Exception```. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | def foo 10 | exception = nil 11 | begin 12 | raise Exception.new('Boo!') 13 | rescue Exception => exception 14 | # Already saved. 15 | end 16 | DebugHelper.show(exception, 'My simple exception') 17 | end 18 | 19 | def bar 20 | foo 21 | end 22 | 23 | def baz 24 | bar 25 | end 26 | 27 | baz 28 | 29 | ``` 30 | 31 | The output shows details of the ```Exception```. 32 | 33 | ```show.yaml```: 34 | ```yaml 35 | --- 36 | Exception (message='My simple exception'): 37 | Exception#message: Boo! 38 | Exception#cause: 39 | Exception#backtrace: 40 | - show.rb:6:in `foo' 41 | - show.rb:14:in `bar' 42 | - show.rb:18:in `baz' 43 | - show.rb:21:in `
' 44 | ``` 45 | -------------------------------------------------------------------------------- /markdown/readme/classes/exception/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | def foo 4 | exception = nil 5 | begin 6 | raise Exception.new('Boo!') 7 | rescue Exception => exception 8 | # Already saved. 9 | end 10 | DebugHelper.show(exception, 'My simple exception') 11 | end 12 | 13 | def bar 14 | foo 15 | end 16 | 17 | def baz 18 | bar 19 | end 20 | 21 | baz 22 | 23 | -------------------------------------------------------------------------------- /markdown/readme/classes/exception/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Exception (message='My simple exception'): 3 | Exception#message: Boo! 4 | Exception#cause: 5 | Exception#backtrace: 6 | - show.rb:6:in `foo' 7 | - show.rb:14:in `bar' 8 | - show.rb:18:in `baz' 9 | - show.rb:21:in `
' 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/exception/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Exception 2 | 3 | This example shows a simple ```Exception```. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```Exception```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/exception/template.md: -------------------------------------------------------------------------------- 1 | ### Exception 2 | 3 | @[:markdown](simple/show.md) 4 | -------------------------------------------------------------------------------- /markdown/readme/classes/file/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple File 2 | 3 | This example shows a simple file. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | gem_file_path = `gem which debug_helper`.chomp 10 | gem_dir_path = File.dirname(gem_file_path) 11 | gem_file_name = File.basename(gem_file_path) 12 | Dir.chdir(gem_dir_path) do 13 | file = File.new(gem_file_name) 14 | DebugHelper.show(file, 'Gem file') 15 | end 16 | ``` 17 | 18 | The output shows details of the file. 19 | 20 | ```show.yaml```: 21 | ```yaml 22 | --- 23 | File (message='Gem file'): 24 | File.absolute_path("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb 25 | File.atime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00 26 | File.ctime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00 27 | File.executable?("debug_helper.rb"): false 28 | File.exist?("debug_helper.rb"): true 29 | File.ftype("debug_helper.rb"): file 30 | File.mtime("debug_helper.rb"): 2019-01-25 15:43:42.741296200 -06:00 31 | File.path("debug_helper.rb"): debug_helper.rb 32 | File.pipe?("debug_helper.rb"): false 33 | File.readable?("debug_helper.rb"): true 34 | File.realpath("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb 35 | File.setgid?("debug_helper.rb"): false 36 | File.setuid?("debug_helper.rb"): false 37 | File.size("debug_helper.rb"): 3701 38 | File.socket?("debug_helper.rb"): false 39 | File.symlink?("debug_helper.rb"): false 40 | File.writable?("debug_helper.rb"): true 41 | ``` 42 | -------------------------------------------------------------------------------- /markdown/readme/classes/file/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | gem_file_path = `gem which debug_helper`.chomp 4 | gem_dir_path = File.dirname(gem_file_path) 5 | gem_file_name = File.basename(gem_file_path) 6 | Dir.chdir(gem_dir_path) do 7 | file = File.new(gem_file_name) 8 | DebugHelper.show(file, 'Gem file') 9 | end 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/file/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | File (message='Gem file'): 3 | File.absolute_path("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb 4 | File.atime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00 5 | File.ctime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00 6 | File.executable?("debug_helper.rb"): false 7 | File.exist?("debug_helper.rb"): true 8 | File.ftype("debug_helper.rb"): file 9 | File.mtime("debug_helper.rb"): 2019-01-25 15:43:42.741296200 -06:00 10 | File.path("debug_helper.rb"): debug_helper.rb 11 | File.pipe?("debug_helper.rb"): false 12 | File.readable?("debug_helper.rb"): true 13 | File.realpath("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb 14 | File.setgid?("debug_helper.rb"): false 15 | File.setuid?("debug_helper.rb"): false 16 | File.size("debug_helper.rb"): 3701 17 | File.socket?("debug_helper.rb"): false 18 | File.symlink?("debug_helper.rb"): false 19 | File.writable?("debug_helper.rb"): true 20 | -------------------------------------------------------------------------------- /markdown/readme/classes/file/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple File 2 | 3 | This example shows a simple file. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the file. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/file/template.md: -------------------------------------------------------------------------------- 1 | ### File 2 | 3 | @[:markdown](simple/show.md) 4 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/circular/show.md: -------------------------------------------------------------------------------- 1 | #### Circular Hashes 2 | 3 | This example shows hashes that make a circular reference. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | hash_0 = {} 10 | hash_1 = {} 11 | hash_0.store(:foo, hash_1) 12 | hash_1.store(:bar, hash_0) 13 | DebugHelper.show(hash_0, 'My circular hashes') 14 | ``` 15 | 16 | The output shows details of the hashes. 17 | 18 | The circular reference is not followed. 19 | 20 | ```show.yaml```: 21 | ```yaml 22 | --- 23 | Hash (message='My circular hashes'): 24 | Hash#size: 1 25 | Hash#default: 26 | Hash#default_proc: 27 | Pair 0: 28 | Key: 29 | Symbol: 30 | Symbol#to_s: foo 31 | Symbol#size: 3 32 | Symbol#encoding: !ruby/encoding US-ASCII 33 | Value: 34 | Hash: 35 | Hash#size: 1 36 | Hash#default: 37 | Hash#default_proc: 38 | Pair 0: 39 | Key: 40 | Symbol: 41 | Symbol#to_s: bar 42 | Symbol#size: 3 43 | Symbol#encoding: !ruby/encoding US-ASCII 44 | Value: Hash {:foo=>{:bar=>{...}}} 45 | ``` 46 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/circular/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | hash_0 = {} 4 | hash_1 = {} 5 | hash_0.store(:foo, hash_1) 6 | hash_1.store(:bar, hash_0) 7 | DebugHelper.show(hash_0, 'My circular hashes') 8 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/circular/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='My circular hashes'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: foo 10 | Symbol#size: 3 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 1 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: bar 21 | Symbol#size: 3 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Hash {:foo=>{:bar=>{...}}} 24 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/circular/template.md: -------------------------------------------------------------------------------- 1 | #### Circular Hashes 2 | 3 | This example shows hashes that make a circular reference. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the hashes. 8 | 9 | The circular reference is not followed. 10 | 11 | @[yaml](show.yaml) 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/mixed/show.md: -------------------------------------------------------------------------------- 1 | #### Mixed Hash 2 | 3 | This example shows a hash of mixed values. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | hash = { 10 | :a => 0, 11 | :b => 'one', 12 | :c => :two, 13 | } 14 | DebugHelper.show(hash, 'My mixed hash') 15 | ``` 16 | 17 | The output shows details of the hash. 18 | 19 | ```show.yaml```: 20 | ```yaml 21 | --- 22 | Hash (message='My mixed hash'): 23 | Hash#size: 3 24 | Hash#default: 25 | Hash#default_proc: 26 | Pair 0: 27 | Key: 28 | Symbol: 29 | Symbol#to_s: a 30 | Symbol#size: 1 31 | Symbol#encoding: !ruby/encoding US-ASCII 32 | Value: Integer 0 33 | Pair 1: 34 | Key: 35 | Symbol: 36 | Symbol#to_s: b 37 | Symbol#size: 1 38 | Symbol#encoding: !ruby/encoding US-ASCII 39 | Value: 40 | String: 41 | String#to_s: one 42 | String#size: 3 43 | String#encoding: !ruby/encoding UTF-8 44 | String#ascii_only?: true 45 | String#bytesize: 3 46 | Pair 2: 47 | Key: 48 | Symbol: 49 | Symbol#to_s: c 50 | Symbol#size: 1 51 | Symbol#encoding: !ruby/encoding US-ASCII 52 | Value: 53 | Symbol: 54 | Symbol#to_s: two 55 | Symbol#size: 3 56 | Symbol#encoding: !ruby/encoding US-ASCII 57 | ``` 58 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/mixed/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | hash = { 4 | :a => 0, 5 | :b => 'one', 6 | :c => :two, 7 | } 8 | DebugHelper.show(hash, 'My mixed hash') 9 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/mixed/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='My mixed hash'): 3 | Hash#size: 3 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 0 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: 20 | String: 21 | String#to_s: one 22 | String#size: 3 23 | String#encoding: !ruby/encoding UTF-8 24 | String#ascii_only?: true 25 | String#bytesize: 3 26 | Pair 2: 27 | Key: 28 | Symbol: 29 | Symbol#to_s: c 30 | Symbol#size: 1 31 | Symbol#encoding: !ruby/encoding US-ASCII 32 | Value: 33 | Symbol: 34 | Symbol#to_s: two 35 | Symbol#size: 3 36 | Symbol#encoding: !ruby/encoding US-ASCII 37 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/mixed/template.md: -------------------------------------------------------------------------------- 1 | #### Mixed Hash 2 | 3 | This example shows a hash of mixed values. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the hash. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/nested/show.md: -------------------------------------------------------------------------------- 1 | #### Nested Hashes 2 | 3 | This example shows nested hashes. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | hash = { 10 | :a => { 11 | :b => 0, 12 | :c => 1, 13 | }, 14 | :d => { 15 | :e => 2, 16 | :f => 3, 17 | } 18 | } 19 | DebugHelper.show(hash, 'My nested hash') 20 | ``` 21 | 22 | The output shows details of the hashes. 23 | 24 | ```show.yaml```: 25 | ```yaml 26 | --- 27 | Hash (message='My nested hash'): 28 | Hash#size: 2 29 | Hash#default: 30 | Hash#default_proc: 31 | Pair 0: 32 | Key: 33 | Symbol: 34 | Symbol#to_s: a 35 | Symbol#size: 1 36 | Symbol#encoding: !ruby/encoding US-ASCII 37 | Value: 38 | Hash: 39 | Hash#size: 2 40 | Hash#default: 41 | Hash#default_proc: 42 | Pair 0: 43 | Key: 44 | Symbol: 45 | Symbol#to_s: b 46 | Symbol#size: 1 47 | Symbol#encoding: !ruby/encoding US-ASCII 48 | Value: Integer 0 49 | Pair 1: 50 | Key: 51 | Symbol: 52 | Symbol#to_s: c 53 | Symbol#size: 1 54 | Symbol#encoding: !ruby/encoding US-ASCII 55 | Value: Integer 1 56 | Pair 1: 57 | Key: 58 | Symbol: 59 | Symbol#to_s: d 60 | Symbol#size: 1 61 | Symbol#encoding: !ruby/encoding US-ASCII 62 | Value: 63 | Hash: 64 | Hash#size: 2 65 | Hash#default: 66 | Hash#default_proc: 67 | Pair 0: 68 | Key: 69 | Symbol: 70 | Symbol#to_s: e 71 | Symbol#size: 1 72 | Symbol#encoding: !ruby/encoding US-ASCII 73 | Value: Integer 2 74 | Pair 1: 75 | Key: 76 | Symbol: 77 | Symbol#to_s: f 78 | Symbol#size: 1 79 | Symbol#encoding: !ruby/encoding US-ASCII 80 | Value: Integer 3 81 | ``` 82 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/nested/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | hash = { 4 | :a => { 5 | :b => 0, 6 | :c => 1, 7 | }, 8 | :d => { 9 | :e => 2, 10 | :f => 3, 11 | } 12 | } 13 | DebugHelper.show(hash, 'My nested hash') 14 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/nested/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='My nested hash'): 3 | Hash#size: 2 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 2 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: b 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Integer 0 24 | Pair 1: 25 | Key: 26 | Symbol: 27 | Symbol#to_s: c 28 | Symbol#size: 1 29 | Symbol#encoding: !ruby/encoding US-ASCII 30 | Value: Integer 1 31 | Pair 1: 32 | Key: 33 | Symbol: 34 | Symbol#to_s: d 35 | Symbol#size: 1 36 | Symbol#encoding: !ruby/encoding US-ASCII 37 | Value: 38 | Hash: 39 | Hash#size: 2 40 | Hash#default: 41 | Hash#default_proc: 42 | Pair 0: 43 | Key: 44 | Symbol: 45 | Symbol#to_s: e 46 | Symbol#size: 1 47 | Symbol#encoding: !ruby/encoding US-ASCII 48 | Value: Integer 2 49 | Pair 1: 50 | Key: 51 | Symbol: 52 | Symbol#to_s: f 53 | Symbol#size: 1 54 | Symbol#encoding: !ruby/encoding US-ASCII 55 | Value: Integer 3 56 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/nested/template.md: -------------------------------------------------------------------------------- 1 | #### Nested Hashes 2 | 3 | This example shows nested hashes. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the hashes. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Hash 2 | 3 | This example shows a simple hash. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | hash = {:a => 0, :b => 1, :c => 2} 10 | DebugHelper.show(hash, 'My simple hash') 11 | ``` 12 | 13 | The output shows details of the hash. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Hash (message='My simple hash'): 19 | Hash#size: 3 20 | Hash#default: 21 | Hash#default_proc: 22 | Pair 0: 23 | Key: 24 | Symbol: 25 | Symbol#to_s: a 26 | Symbol#size: 1 27 | Symbol#encoding: !ruby/encoding US-ASCII 28 | Value: Integer 0 29 | Pair 1: 30 | Key: 31 | Symbol: 32 | Symbol#to_s: b 33 | Symbol#size: 1 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | Value: Integer 1 36 | Pair 2: 37 | Key: 38 | Symbol: 39 | Symbol#to_s: c 40 | Symbol#size: 1 41 | Symbol#encoding: !ruby/encoding US-ASCII 42 | Value: Integer 2 43 | ``` 44 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | hash = {:a => 0, :b => 1, :c => 2} 4 | DebugHelper.show(hash, 'My simple hash') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='My simple hash'): 3 | Hash#size: 3 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 0 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 1 20 | Pair 2: 21 | Key: 22 | Symbol: 23 | Symbol#to_s: c 24 | Symbol#size: 1 25 | Symbol#encoding: !ruby/encoding US-ASCII 26 | Value: Integer 2 27 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Hash 2 | 3 | This example shows a simple hash. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the hash. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/hash/template.md: -------------------------------------------------------------------------------- 1 | ### Hash 2 | 3 | @[:markdown](simple/show.md) 4 | 5 | @[:markdown](mixed/show.md) 6 | 7 | @[:markdown](nested/show.md) 8 | 9 | @[:markdown](circular/show.md) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/io/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple IO 2 | 3 | This example shows a simple ```IO```. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | io = IO.new(IO.sysopen(__FILE__, 'r'), 'r') 10 | DebugHelper.show(io, 'My simple io') 11 | ``` 12 | 13 | The output shows details of the ```IO```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | IO (message='My simple io'): 19 | IO#autoclose?: true 20 | IO#binmode?: false 21 | IO#closed?: false 22 | IO#tty?: false 23 | ``` 24 | -------------------------------------------------------------------------------- /markdown/readme/classes/io/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | io = IO.new(IO.sysopen(__FILE__, 'r'), 'r') 4 | DebugHelper.show(io, 'My simple io') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/io/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | IO (message='My simple io'): 3 | IO#autoclose?: true 4 | IO#binmode?: false 5 | IO#closed?: false 6 | IO#tty?: false 7 | -------------------------------------------------------------------------------- /markdown/readme/classes/io/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple IO 2 | 3 | This example shows a simple ```IO```. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```IO```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/io/template.md: -------------------------------------------------------------------------------- 1 | ### IO 2 | 3 | @[:markdown](simple/show.md) 4 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/multiple_captures/show.md: -------------------------------------------------------------------------------- 1 | #### Multiple Captures 2 | 3 | This example shows a ```MatchData``` with multiple captures. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | match_data = /(.)(.)(\d+)(\d)/.match('THX1138.') 10 | DebugHelper.show(match_data, 'My MatchData with named captures') 11 | ``` 12 | 13 | The output shows details of the ```MatchData```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | MatchData (message='My MatchData with named captures'): 19 | MatchData#size: 5 20 | MatchData#regexp: !ruby/regexp /(.)(.)(\d+)(\d)/ 21 | MatchData#to_a: 22 | - HX1138 23 | - H 24 | - X 25 | - '113' 26 | - '8' 27 | MatchData#captures: 28 | - H 29 | - X 30 | - '113' 31 | - '8' 32 | MatchData#names: [] 33 | ``` 34 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/multiple_captures/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | match_data = /(.)(.)(\d+)(\d)/.match('THX1138.') 4 | DebugHelper.show(match_data, 'My MatchData with named captures') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/multiple_captures/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | MatchData (message='My MatchData with named captures'): 3 | MatchData#size: 5 4 | MatchData#regexp: !ruby/regexp /(.)(.)(\d+)(\d)/ 5 | MatchData#to_a: 6 | - HX1138 7 | - H 8 | - X 9 | - '113' 10 | - '8' 11 | MatchData#captures: 12 | - H 13 | - X 14 | - '113' 15 | - '8' 16 | MatchData#names: [] 17 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/multiple_captures/template.md: -------------------------------------------------------------------------------- 1 | #### Multiple Captures 2 | 3 | This example shows a ```MatchData``` with multiple captures. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```MatchData```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/named_captures/show.md: -------------------------------------------------------------------------------- 1 | #### Named Captures 2 | 3 | This example shows a ```MatchData``` with named captures. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | match_data = /(?.)(?.)?/.match("a") 10 | DebugHelper.show(match_data, 'My MatchData with named captures') 11 | ``` 12 | 13 | The output shows details of the ```MatchData```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | MatchData (message='My MatchData with named captures'): 19 | MatchData#size: 3 20 | MatchData#regexp: !ruby/regexp /(?.)(?.)?/ 21 | MatchData#to_a: 22 | - a 23 | - a 24 | - 25 | MatchData#captures: 26 | - a 27 | - 28 | MatchData#names: 29 | - x 30 | - y 31 | ``` 32 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/named_captures/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | match_data = /(?.)(?.)?/.match("a") 4 | DebugHelper.show(match_data, 'My MatchData with named captures') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/named_captures/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | MatchData (message='My MatchData with named captures'): 3 | MatchData#size: 3 4 | MatchData#regexp: !ruby/regexp /(?.)(?.)?/ 5 | MatchData#to_a: 6 | - a 7 | - a 8 | - 9 | MatchData#captures: 10 | - a 11 | - 12 | MatchData#names: 13 | - x 14 | - y 15 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/named_captures/template.md: -------------------------------------------------------------------------------- 1 | #### Named Captures 2 | 3 | This example shows a ```MatchData``` with named captures. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```MatchData```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple MatchData 2 | 3 | This example shows a simple ```MatchData```. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | match_data = /[a-z]/.match('abc') 10 | DebugHelper.show(match_data, 'My simple MatchData') 11 | ``` 12 | 13 | The output shows details of the ```MatchData```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | MatchData (message='My simple MatchData'): 19 | MatchData#size: 1 20 | MatchData#regexp: !ruby/regexp /[a-z]/ 21 | MatchData#to_a: 22 | - a 23 | MatchData#captures: [] 24 | MatchData#names: [] 25 | ``` 26 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | match_data = /[a-z]/.match('abc') 4 | DebugHelper.show(match_data, 'My simple MatchData') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | MatchData (message='My simple MatchData'): 3 | MatchData#size: 1 4 | MatchData#regexp: !ruby/regexp /[a-z]/ 5 | MatchData#to_a: 6 | - a 7 | MatchData#captures: [] 8 | MatchData#names: [] 9 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple MatchData 2 | 3 | This example shows a simple ```MatchData```. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```MatchData```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/match_data/template.md: -------------------------------------------------------------------------------- 1 | ### MatchData 2 | 3 | @[:markdown](simple/show.md) 4 | 5 | @[:markdown](multiple_captures/show.md) 6 | 7 | @[:markdown](named_captures/show.md) 8 | -------------------------------------------------------------------------------- /markdown/readme/classes/method/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Method 2 | 3 | This example shows a simple ```Method```. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | m = method(:puts) 10 | DebugHelper.show(m, 'My simple Method') 11 | ``` 12 | 13 | The output shows details of the ```Method```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Method (message='My simple Method'): 19 | Method#arity: -1 20 | Method#inspect: "#" 21 | Method#name: :puts 22 | Method#original_name: :puts 23 | Method#owner: !ruby/module 'Kernel' 24 | Method#parameters: 25 | - - :rest 26 | Method#source_location: 27 | Method#super_method: 28 | ``` 29 | -------------------------------------------------------------------------------- /markdown/readme/classes/method/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | m = method(:puts) 4 | DebugHelper.show(m, 'My simple Method') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/method/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Method (message='My simple Method'): 3 | Method#arity: -1 4 | Method#inspect: "#" 5 | Method#name: :puts 6 | Method#original_name: :puts 7 | Method#owner: !ruby/module 'Kernel' 8 | Method#parameters: 9 | - - :rest 10 | Method#source_location: 11 | Method#super_method: 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/method/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Method 2 | 3 | This example shows a simple ```Method```. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```Method```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/method/template.md: -------------------------------------------------------------------------------- 1 | ### Method 2 | 3 | @[:markdown](simple/show.md) 4 | -------------------------------------------------------------------------------- /markdown/readme/classes/object/object/show.md: -------------------------------------------------------------------------------- 1 | #### Unanalyzed Object 2 | 3 | This example shows an object that will not be analyzed. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | class MyClass 10 | def inspect 11 | 'My class inspection' 12 | end 13 | end 14 | DebugHelper.show(MyClass.new, 'My class') 15 | ``` 16 | 17 | The output shows details of the object. 18 | 19 | ```show.yaml```: 20 | ```yaml 21 | --- MyClass (message='My class') My class inspection 22 | ``` 23 | -------------------------------------------------------------------------------- /markdown/readme/classes/object/object/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | class MyClass 4 | def inspect 5 | 'My class inspection' 6 | end 7 | end 8 | DebugHelper.show(MyClass.new, 'My class') 9 | -------------------------------------------------------------------------------- /markdown/readme/classes/object/object/show.yaml: -------------------------------------------------------------------------------- 1 | --- MyClass (message='My class') My class inspection 2 | -------------------------------------------------------------------------------- /markdown/readme/classes/object/object/template.md: -------------------------------------------------------------------------------- 1 | #### Unanalyzed Object 2 | 3 | This example shows an object that will not be analyzed. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the object. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/object/template.md: -------------------------------------------------------------------------------- 1 | ### Object 2 | 3 | Classes not mentioned above are not analyzed, but are treated more simply. 4 | 5 | @[:markdown](object/show.md) 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/circular/show.md: -------------------------------------------------------------------------------- 1 | #### Circular OpenStructs 2 | 3 | This example shows open structs that make a circular reference. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'ostruct' 8 | require 'debug_helper' 9 | 10 | ostruct_0 = OpenStruct.new 11 | ostruct_1 = OpenStruct.new 12 | ostruct_0.a = ostruct_1 13 | ostruct_1.a = ostruct_0 14 | DebugHelper.show(ostruct_0, 'My circular ostruct') 15 | ``` 16 | 17 | The output shows details of the open structs. 18 | 19 | The circular reference is not followed. 20 | 21 | ```show.yaml```: 22 | ```yaml 23 | --- 24 | OpenStruct (message='My circular ostruct'): 25 | Member 0: 26 | Name: 27 | Symbol: 28 | Symbol#to_s: a 29 | Symbol#size: 1 30 | Symbol#encoding: !ruby/encoding US-ASCII 31 | Value: 32 | OpenStruct: 33 | Member 0: 34 | Name: 35 | Symbol: 36 | Symbol#to_s: a 37 | Symbol#size: 1 38 | Symbol#encoding: !ruby/encoding US-ASCII 39 | Value: 'OpenStruct #>>' 40 | ``` 41 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/circular/show.rb: -------------------------------------------------------------------------------- 1 | require 'ostruct' 2 | require 'debug_helper' 3 | 4 | ostruct_0 = OpenStruct.new 5 | ostruct_1 = OpenStruct.new 6 | ostruct_0.a = ostruct_1 7 | ostruct_1.a = ostruct_0 8 | DebugHelper.show(ostruct_0, 'My circular ostruct') 9 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/circular/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='My circular ostruct'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: 10 | OpenStruct: 11 | Member 0: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: a 15 | Symbol#size: 1 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: 'OpenStruct #>>' 18 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/circular/template.md: -------------------------------------------------------------------------------- 1 | #### Circular OpenStructs 2 | 3 | This example shows open structs that make a circular reference. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the open structs. 8 | 9 | The circular reference is not followed. 10 | 11 | @[yaml](show.yaml) 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/mixed/show.md: -------------------------------------------------------------------------------- 1 | #### Mixed OpenStruct 2 | 3 | This example shows an open struct of mixed values. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'ostruct' 8 | require 'debug_helper' 9 | 10 | ostruct = OpenStruct.new(:a => 0, :b => 'one', :c => :two) 11 | DebugHelper.show(ostruct, 'My mixed open struct') 12 | ``` 13 | 14 | The output shows details of the open struct. 15 | 16 | ```show.yaml```: 17 | ```yaml 18 | --- 19 | OpenStruct (message='My mixed open struct'): 20 | Member 0: 21 | Name: 22 | Symbol: 23 | Symbol#to_s: a 24 | Symbol#size: 1 25 | Symbol#encoding: !ruby/encoding US-ASCII 26 | Value: Integer 0 27 | Member 1: 28 | Name: 29 | Symbol: 30 | Symbol#to_s: b 31 | Symbol#size: 1 32 | Symbol#encoding: !ruby/encoding US-ASCII 33 | Value: 34 | String: 35 | String#to_s: one 36 | String#size: 3 37 | String#encoding: !ruby/encoding UTF-8 38 | String#ascii_only?: true 39 | String#bytesize: 3 40 | Member 2: 41 | Name: 42 | Symbol: 43 | Symbol#to_s: c 44 | Symbol#size: 1 45 | Symbol#encoding: !ruby/encoding US-ASCII 46 | Value: 47 | Symbol: 48 | Symbol#to_s: two 49 | Symbol#size: 3 50 | Symbol#encoding: !ruby/encoding US-ASCII 51 | ``` 52 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/mixed/show.rb: -------------------------------------------------------------------------------- 1 | require 'ostruct' 2 | require 'debug_helper' 3 | 4 | ostruct = OpenStruct.new(:a => 0, :b => 'one', :c => :two) 5 | DebugHelper.show(ostruct, 'My mixed open struct') 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/mixed/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='My mixed open struct'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: 17 | String: 18 | String#to_s: one 19 | String#size: 3 20 | String#encoding: !ruby/encoding UTF-8 21 | String#ascii_only?: true 22 | String#bytesize: 3 23 | Member 2: 24 | Name: 25 | Symbol: 26 | Symbol#to_s: c 27 | Symbol#size: 1 28 | Symbol#encoding: !ruby/encoding US-ASCII 29 | Value: 30 | Symbol: 31 | Symbol#to_s: two 32 | Symbol#size: 3 33 | Symbol#encoding: !ruby/encoding US-ASCII 34 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/mixed/template.md: -------------------------------------------------------------------------------- 1 | #### Mixed OpenStruct 2 | 3 | This example shows an open struct of mixed values. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the open struct. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/nested/show.md: -------------------------------------------------------------------------------- 1 | #### Nested OpenStructs 2 | 3 | This example shows nested open structs. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'ostruct' 8 | require 'debug_helper' 9 | 10 | ostruct = OpenStruct.new( 11 | :a => OpenStruct.new( 12 | :b => 0, 13 | :c => 1, 14 | ), 15 | :d => OpenStruct.new( 16 | :e => 2, 17 | :f => 3, 18 | ) 19 | ) 20 | DebugHelper.show(ostruct, 'My nested struct') 21 | ``` 22 | 23 | The output shows details of the open structs. 24 | 25 | ```show.yaml```: 26 | ```yaml 27 | --- 28 | OpenStruct (message='My nested struct'): 29 | Member 0: 30 | Name: 31 | Symbol: 32 | Symbol#to_s: a 33 | Symbol#size: 1 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | Value: 36 | OpenStruct: 37 | Member 0: 38 | Name: 39 | Symbol: 40 | Symbol#to_s: b 41 | Symbol#size: 1 42 | Symbol#encoding: !ruby/encoding US-ASCII 43 | Value: Integer 0 44 | Member 1: 45 | Name: 46 | Symbol: 47 | Symbol#to_s: c 48 | Symbol#size: 1 49 | Symbol#encoding: !ruby/encoding US-ASCII 50 | Value: Integer 1 51 | Member 1: 52 | Name: 53 | Symbol: 54 | Symbol#to_s: d 55 | Symbol#size: 1 56 | Symbol#encoding: !ruby/encoding US-ASCII 57 | Value: 58 | OpenStruct: 59 | Member 0: 60 | Name: 61 | Symbol: 62 | Symbol#to_s: e 63 | Symbol#size: 1 64 | Symbol#encoding: !ruby/encoding US-ASCII 65 | Value: Integer 2 66 | Member 1: 67 | Name: 68 | Symbol: 69 | Symbol#to_s: f 70 | Symbol#size: 1 71 | Symbol#encoding: !ruby/encoding US-ASCII 72 | Value: Integer 3 73 | ``` 74 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/nested/show.rb: -------------------------------------------------------------------------------- 1 | require 'ostruct' 2 | require 'debug_helper' 3 | 4 | ostruct = OpenStruct.new( 5 | :a => OpenStruct.new( 6 | :b => 0, 7 | :c => 1, 8 | ), 9 | :d => OpenStruct.new( 10 | :e => 2, 11 | :f => 3, 12 | ) 13 | ) 14 | DebugHelper.show(ostruct, 'My nested struct') 15 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/nested/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='My nested struct'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: 10 | OpenStruct: 11 | Member 0: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: b 15 | Symbol#size: 1 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: Integer 0 18 | Member 1: 19 | Name: 20 | Symbol: 21 | Symbol#to_s: c 22 | Symbol#size: 1 23 | Symbol#encoding: !ruby/encoding US-ASCII 24 | Value: Integer 1 25 | Member 1: 26 | Name: 27 | Symbol: 28 | Symbol#to_s: d 29 | Symbol#size: 1 30 | Symbol#encoding: !ruby/encoding US-ASCII 31 | Value: 32 | OpenStruct: 33 | Member 0: 34 | Name: 35 | Symbol: 36 | Symbol#to_s: e 37 | Symbol#size: 1 38 | Symbol#encoding: !ruby/encoding US-ASCII 39 | Value: Integer 2 40 | Member 1: 41 | Name: 42 | Symbol: 43 | Symbol#to_s: f 44 | Symbol#size: 1 45 | Symbol#encoding: !ruby/encoding US-ASCII 46 | Value: Integer 3 47 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/nested/template.md: -------------------------------------------------------------------------------- 1 | #### Nested OpenStructs 2 | 3 | This example shows nested open structs. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the open structs. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple OpenStruct 2 | 3 | This example shows a simple open struct. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'ostruct' 8 | require 'debug_helper' 9 | 10 | ostruct = OpenStruct.new(:a => 0, :b => 1, :c => 2) 11 | DebugHelper.show(ostruct, 'My simple struct') 12 | ``` 13 | 14 | The output shows details of the open struct. 15 | 16 | ```show.yaml```: 17 | ```yaml 18 | --- 19 | OpenStruct (message='My simple struct'): 20 | Member 0: 21 | Name: 22 | Symbol: 23 | Symbol#to_s: a 24 | Symbol#size: 1 25 | Symbol#encoding: !ruby/encoding US-ASCII 26 | Value: Integer 0 27 | Member 1: 28 | Name: 29 | Symbol: 30 | Symbol#to_s: b 31 | Symbol#size: 1 32 | Symbol#encoding: !ruby/encoding US-ASCII 33 | Value: Integer 1 34 | Member 2: 35 | Name: 36 | Symbol: 37 | Symbol#to_s: c 38 | Symbol#size: 1 39 | Symbol#encoding: !ruby/encoding US-ASCII 40 | Value: Integer 2 41 | ``` 42 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'ostruct' 2 | require 'debug_helper' 3 | 4 | ostruct = OpenStruct.new(:a => 0, :b => 1, :c => 2) 5 | DebugHelper.show(ostruct, 'My simple struct') 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='My simple struct'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: Integer 1 17 | Member 2: 18 | Name: 19 | Symbol: 20 | Symbol#to_s: c 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Integer 2 24 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple OpenStruct 2 | 3 | This example shows a simple open struct. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the open struct. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/open_struct/template.md: -------------------------------------------------------------------------------- 1 | ### OpenStruct 2 | 3 | @[:markdown](simple/show.md) 4 | 5 | @[:markdown](mixed/show.md) 6 | 7 | @[:markdown](nested/show.md) 8 | 9 | @[:markdown](circular/show.md) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/exclude_end/show.md: -------------------------------------------------------------------------------- 1 | #### Exclusive Range 2 | 3 | This example shows a ```Range``` that excludes its end value. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | range = (0...4) 10 | DebugHelper.show(range, 'My exclusive range') 11 | ``` 12 | 13 | The output shows details of the ```Range```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Range (message='My exclusive range'): 19 | Range#first: 0 20 | Range#last: 4 21 | Range#exclude_end?: true 22 | ``` 23 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/exclude_end/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | range = (0...4) 4 | DebugHelper.show(range, 'My exclusive range') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/exclude_end/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Range (message='My exclusive range'): 3 | Range#first: 0 4 | Range#last: 4 5 | Range#exclude_end?: true 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/exclude_end/template.md: -------------------------------------------------------------------------------- 1 | #### Exclusive Range 2 | 3 | This example shows a ```Range``` that excludes its end value. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```Range```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/include_end/show.md: -------------------------------------------------------------------------------- 1 | #### Inclusive Range 2 | 3 | This example shows a ```Range``` that includes its end value. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | range = (0..4) 10 | DebugHelper.show(range, 'My inclusive range') 11 | ``` 12 | 13 | The output shows details of the ```Range```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Range (message='My inclusive range'): 19 | Range#first: 0 20 | Range#last: 4 21 | Range#exclude_end?: false 22 | ``` 23 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/include_end/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | range = (0..4) 4 | DebugHelper.show(range, 'My inclusive range') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/include_end/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Range (message='My inclusive range'): 3 | Range#first: 0 4 | Range#last: 4 5 | Range#exclude_end?: false 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/include_end/template.md: -------------------------------------------------------------------------------- 1 | #### Inclusive Range 2 | 3 | This example shows a ```Range``` that includes its end value. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```Range```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/range/template.md: -------------------------------------------------------------------------------- 1 | ### Range 2 | 3 | @[:markdown](include_end/show.md) 4 | 5 | @[:markdown](exclude_end/show.md) 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/named_captures/show.md: -------------------------------------------------------------------------------- 1 | #### Named Captures 2 | 3 | This example shows a ```Regexp``` with named captures. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | regexp = Regexp.new(/(?.)(?.)/) 10 | DebugHelper.show(regexp, 'My regexp with named captures') 11 | ``` 12 | 13 | The output shows details of the ```Regexp```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Regexp (message='My regexp with named captures'): 19 | Regexp#to_s: "(?-mix:(?.)(?.))" 20 | Regexp#casefold?: false 21 | Regexp#named_captures: 22 | a: 23 | - 1 24 | b: 25 | - 2 26 | Regexp#encoding: !ruby/encoding US-ASCII 27 | Regexp#fixed_encoding?: false 28 | ``` 29 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/named_captures/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | regexp = Regexp.new(/(?.)(?.)/) 4 | DebugHelper.show(regexp, 'My regexp with named captures') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/named_captures/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Regexp (message='My regexp with named captures'): 3 | Regexp#to_s: "(?-mix:(?.)(?.))" 4 | Regexp#casefold?: false 5 | Regexp#named_captures: 6 | a: 7 | - 1 8 | b: 9 | - 2 10 | Regexp#encoding: !ruby/encoding US-ASCII 11 | Regexp#fixed_encoding?: false 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/named_captures/template.md: -------------------------------------------------------------------------------- 1 | #### Named Captures 2 | 3 | This example shows a ```Regexp``` with named captures. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```Regexp```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Regexp 2 | 3 | This example shows a simple ```Regexp```. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | regexp = Regexp.new(/\w+/) 10 | DebugHelper.show(regexp, 'My simple regexp') 11 | ``` 12 | 13 | The output shows details of the ```Regexp```. 14 | 15 | ```show.yaml```: 16 | ```yaml 17 | --- 18 | Regexp (message='My simple regexp'): 19 | Regexp#to_s: "(?-mix:\\w+)" 20 | Regexp#casefold?: false 21 | Regexp#named_captures: {} 22 | Regexp#encoding: !ruby/encoding US-ASCII 23 | Regexp#fixed_encoding?: false 24 | ``` 25 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | regexp = Regexp.new(/\w+/) 4 | DebugHelper.show(regexp, 'My simple regexp') 5 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Regexp (message='My simple regexp'): 3 | Regexp#to_s: "(?-mix:\\w+)" 4 | Regexp#casefold?: false 5 | Regexp#named_captures: {} 6 | Regexp#encoding: !ruby/encoding US-ASCII 7 | Regexp#fixed_encoding?: false 8 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Regexp 2 | 3 | This example shows a simple ```Regexp```. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the ```Regexp```. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/regexp/template.md: -------------------------------------------------------------------------------- 1 | ### Regexp 2 | 3 | @[:markdown](simple/show.md) 4 | 5 | @[:markdown](named_captures/show.md) 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/circular/show.md: -------------------------------------------------------------------------------- 1 | #### Circular Sets 2 | 3 | This example shows sets that make a circular reference. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'set' 8 | 9 | require 'debug_helper' 10 | 11 | set_0 = Set.new([]) 12 | set_1 = Set.new([]) 13 | set_0.add(set_1) 14 | set_1.add(set_0) 15 | DebugHelper.show(set_0, 'My circular sets') 16 | ``` 17 | 18 | The output shows details of the sets. 19 | 20 | The circular reference is not followed. 21 | 22 | ```show.yaml```: 23 | ```yaml 24 | --- 25 | Set (message='My circular sets'): 26 | Set#size: 1 27 | Element 0: 28 | Set: 29 | Set#size: 1 30 | Element 0: 'Set #}>}>' 31 | ``` 32 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/circular/show.rb: -------------------------------------------------------------------------------- 1 | require 'set' 2 | 3 | require 'debug_helper' 4 | 5 | set_0 = Set.new([]) 6 | set_1 = Set.new([]) 7 | set_0.add(set_1) 8 | set_1.add(set_0) 9 | DebugHelper.show(set_0, 'My circular sets') 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/circular/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='My circular sets'): 3 | Set#size: 1 4 | Element 0: 5 | Set: 6 | Set#size: 1 7 | Element 0: 'Set #}>}>' 8 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/circular/template.md: -------------------------------------------------------------------------------- 1 | #### Circular Sets 2 | 3 | This example shows sets that make a circular reference. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the sets. 8 | 9 | The circular reference is not followed. 10 | 11 | @[yaml](show.yaml) 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/mixed/show.md: -------------------------------------------------------------------------------- 1 | #### Mixed Set 2 | 3 | This example shows a set of mixed values. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | require 'set' 10 | 11 | set = Set.new([0, 'one', :two]) 12 | DebugHelper.show(set, 'My mixed set') 13 | ``` 14 | 15 | The output shows details of the set. 16 | 17 | ```show.yaml```: 18 | ```yaml 19 | --- 20 | Set (message='My mixed set'): 21 | Set#size: 3 22 | Element 0: Integer 0 23 | Element 1: 24 | String: 25 | String#to_s: one 26 | String#size: 3 27 | String#encoding: !ruby/encoding UTF-8 28 | String#ascii_only?: true 29 | String#bytesize: 3 30 | Element 2: 31 | Symbol: 32 | Symbol#to_s: two 33 | Symbol#size: 3 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | ``` 36 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/mixed/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | require 'set' 4 | 5 | set = Set.new([0, 'one', :two]) 6 | DebugHelper.show(set, 'My mixed set') 7 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/mixed/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='My mixed set'): 3 | Set#size: 3 4 | Element 0: Integer 0 5 | Element 1: 6 | String: 7 | String#to_s: one 8 | String#size: 3 9 | String#encoding: !ruby/encoding UTF-8 10 | String#ascii_only?: true 11 | String#bytesize: 3 12 | Element 2: 13 | Symbol: 14 | Symbol#to_s: two 15 | Symbol#size: 3 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/mixed/template.md: -------------------------------------------------------------------------------- 1 | #### Mixed Set 2 | 3 | This example shows a set of mixed values. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the set. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/nested/show.md: -------------------------------------------------------------------------------- 1 | #### Nested Sets 2 | 3 | This example shows nested sets. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'set' 8 | 9 | require 'debug_helper' 10 | 11 | set = Set.new( 12 | [0, 13 | Set.new([1, 2]), 14 | Set.new([3, 4]), 15 | ]) 16 | DebugHelper.show(set, 'My nested sets') 17 | ``` 18 | 19 | The output shows details of the sets. 20 | 21 | ```show.yaml```: 22 | ```yaml 23 | --- 24 | Set (message='My nested sets'): 25 | Set#size: 3 26 | Element 0: Integer 0 27 | Element 1: 28 | Set: 29 | Set#size: 2 30 | Element 0: Integer 1 31 | Element 1: Integer 2 32 | Element 2: 33 | Set: 34 | Set#size: 2 35 | Element 0: Integer 3 36 | Element 1: Integer 4 37 | ``` 38 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/nested/show.rb: -------------------------------------------------------------------------------- 1 | require 'set' 2 | 3 | require 'debug_helper' 4 | 5 | set = Set.new( 6 | [0, 7 | Set.new([1, 2]), 8 | Set.new([3, 4]), 9 | ]) 10 | DebugHelper.show(set, 'My nested sets') 11 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/nested/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='My nested sets'): 3 | Set#size: 3 4 | Element 0: Integer 0 5 | Element 1: 6 | Set: 7 | Set#size: 2 8 | Element 0: Integer 1 9 | Element 1: Integer 2 10 | Element 2: 11 | Set: 12 | Set#size: 2 13 | Element 0: Integer 3 14 | Element 1: Integer 4 15 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/nested/template.md: -------------------------------------------------------------------------------- 1 | #### Nested Sets 2 | 3 | This example shows nested sets. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the sets. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Set 2 | 3 | This example shows a simple set of integers. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'set' 8 | 9 | require 'debug_helper' 10 | 11 | set = Set.new([5, 10, 15]) 12 | DebugHelper.show(set, 'My simple set') 13 | ``` 14 | 15 | The output shows details of the set. 16 | 17 | ```show.yaml```: 18 | ```yaml 19 | --- 20 | Set (message='My simple set'): 21 | Set#size: 3 22 | Element 0: Integer 5 23 | Element 1: Integer 10 24 | Element 2: Integer 15 25 | ``` 26 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'set' 2 | 3 | require 'debug_helper' 4 | 5 | set = Set.new([5, 10, 15]) 6 | DebugHelper.show(set, 'My simple set') 7 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='My simple set'): 3 | Set#size: 3 4 | Element 0: Integer 5 5 | Element 1: Integer 10 6 | Element 2: Integer 15 7 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Set 2 | 3 | This example shows a simple set of integers. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the set. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/set/template.md: -------------------------------------------------------------------------------- 1 | ### Set 2 | 3 | @[:markdown](simple/show.md) 4 | 5 | @[:markdown](mixed/show.md) 6 | 7 | @[:markdown](nested/show.md) 8 | 9 | @[:markdown](circular/show.md) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/string/multiline/show.md: -------------------------------------------------------------------------------- 1 | #### Multiline String 2 | 3 | This example shows a multiline string. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | s = <, 42 | b=4, c=5>, b=1, c=2>' 43 | Member 1: 44 | Name: 45 | Symbol: 46 | Symbol#to_s: b 47 | Symbol#size: 1 48 | Symbol#encoding: !ruby/encoding US-ASCII 49 | Value: Integer 4 50 | Member 2: 51 | Name: 52 | Symbol: 53 | Symbol#to_s: c 54 | Symbol#size: 1 55 | Symbol#encoding: !ruby/encoding US-ASCII 56 | Value: Integer 5 57 | Member 1: 58 | Name: 59 | Symbol: 60 | Symbol#to_s: b 61 | Symbol#size: 1 62 | Symbol#encoding: !ruby/encoding US-ASCII 63 | Value: Integer 1 64 | Member 2: 65 | Name: 66 | Symbol: 67 | Symbol#to_s: c 68 | Symbol#size: 1 69 | Symbol#encoding: !ruby/encoding US-ASCII 70 | Value: Integer 2 71 | ``` 72 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/circular/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | MyStruct = Struct.new(:a, :b, :c) 4 | struct_0 = MyStruct.new(0, 1, 2) 5 | struct_1 = MyStruct.new(3, 4, 5) 6 | struct_0.a = struct_1 7 | struct_1.a = struct_0 8 | DebugHelper.show(struct_0, 'My circular struct') 9 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/circular/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | MyStruct (message='My circular struct'): 3 | MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: a 8 | Symbol#size: 1 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: 11 | MyStruct: 12 | MyStruct#size: 3 13 | Member 0: 14 | Name: 15 | Symbol: 16 | Symbol#to_s: a 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: 'MyStruct #, 20 | b=4, c=5>, b=1, c=2>' 21 | Member 1: 22 | Name: 23 | Symbol: 24 | Symbol#to_s: b 25 | Symbol#size: 1 26 | Symbol#encoding: !ruby/encoding US-ASCII 27 | Value: Integer 4 28 | Member 2: 29 | Name: 30 | Symbol: 31 | Symbol#to_s: c 32 | Symbol#size: 1 33 | Symbol#encoding: !ruby/encoding US-ASCII 34 | Value: Integer 5 35 | Member 1: 36 | Name: 37 | Symbol: 38 | Symbol#to_s: b 39 | Symbol#size: 1 40 | Symbol#encoding: !ruby/encoding US-ASCII 41 | Value: Integer 1 42 | Member 2: 43 | Name: 44 | Symbol: 45 | Symbol#to_s: c 46 | Symbol#size: 1 47 | Symbol#encoding: !ruby/encoding US-ASCII 48 | Value: Integer 2 49 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/circular/template.md: -------------------------------------------------------------------------------- 1 | #### Circular Structs 2 | 3 | This example shows structs that make a circular reference. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the structs. 8 | 9 | The circular reference is not followed. 10 | 11 | @[yaml](show.yaml) 12 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/mixed/show.md: -------------------------------------------------------------------------------- 1 | #### Mixed Struct 2 | 3 | This example shows a struct of mixed values. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | MyStruct = Struct.new(:a, :b, :c) 10 | struct = MyStruct.new(0, 'one', :two) 11 | DebugHelper.show(struct, 'My mixed struct') 12 | ``` 13 | 14 | The output shows details of the struct. 15 | 16 | ```show.yaml```: 17 | ```yaml 18 | --- 19 | MyStruct (message='My mixed struct'): 20 | MyStruct#size: 3 21 | Member 0: 22 | Name: 23 | Symbol: 24 | Symbol#to_s: a 25 | Symbol#size: 1 26 | Symbol#encoding: !ruby/encoding US-ASCII 27 | Value: Integer 0 28 | Member 1: 29 | Name: 30 | Symbol: 31 | Symbol#to_s: b 32 | Symbol#size: 1 33 | Symbol#encoding: !ruby/encoding US-ASCII 34 | Value: 35 | String: 36 | String#to_s: one 37 | String#size: 3 38 | String#encoding: !ruby/encoding UTF-8 39 | String#ascii_only?: true 40 | String#bytesize: 3 41 | Member 2: 42 | Name: 43 | Symbol: 44 | Symbol#to_s: c 45 | Symbol#size: 1 46 | Symbol#encoding: !ruby/encoding US-ASCII 47 | Value: 48 | Symbol: 49 | Symbol#to_s: two 50 | Symbol#size: 3 51 | Symbol#encoding: !ruby/encoding US-ASCII 52 | ``` 53 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/mixed/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | MyStruct = Struct.new(:a, :b, :c) 4 | struct = MyStruct.new(0, 'one', :two) 5 | DebugHelper.show(struct, 'My mixed struct') 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/mixed/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | MyStruct (message='My mixed struct'): 3 | MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: a 8 | Symbol#size: 1 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: Integer 0 11 | Member 1: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: b 15 | Symbol#size: 1 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: 18 | String: 19 | String#to_s: one 20 | String#size: 3 21 | String#encoding: !ruby/encoding UTF-8 22 | String#ascii_only?: true 23 | String#bytesize: 3 24 | Member 2: 25 | Name: 26 | Symbol: 27 | Symbol#to_s: c 28 | Symbol#size: 1 29 | Symbol#encoding: !ruby/encoding US-ASCII 30 | Value: 31 | Symbol: 32 | Symbol#to_s: two 33 | Symbol#size: 3 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/mixed/template.md: -------------------------------------------------------------------------------- 1 | #### Mixed Struct 2 | 3 | This example shows a struct of mixed values. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the struct. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/nested/show.md: -------------------------------------------------------------------------------- 1 | #### Nested Structs 2 | 3 | This example shows nested structs. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | MyStruct_0 = Struct.new(:a, :b) 10 | MyStruct_1 = Struct.new(:c, :d) 11 | struct_1a = MyStruct_1.new(2, 3) 12 | struct_1b = MyStruct_1.new(4, 5) 13 | struct_0 = MyStruct_0.new(struct_1a, struct_1b) 14 | DebugHelper.show(struct_0, 'My nested struct') 15 | ``` 16 | 17 | The output shows details of the structs. 18 | 19 | ```show.yaml```: 20 | ```yaml 21 | --- 22 | MyStruct_0 (message='My nested struct'): 23 | MyStruct_0#size: 2 24 | Member 0: 25 | Name: 26 | Symbol: 27 | Symbol#to_s: a 28 | Symbol#size: 1 29 | Symbol#encoding: !ruby/encoding US-ASCII 30 | Value: 31 | MyStruct_1: 32 | MyStruct_1#size: 2 33 | Member 0: 34 | Name: 35 | Symbol: 36 | Symbol#to_s: c 37 | Symbol#size: 1 38 | Symbol#encoding: !ruby/encoding US-ASCII 39 | Value: Integer 2 40 | Member 1: 41 | Name: 42 | Symbol: 43 | Symbol#to_s: d 44 | Symbol#size: 1 45 | Symbol#encoding: !ruby/encoding US-ASCII 46 | Value: Integer 3 47 | Member 1: 48 | Name: 49 | Symbol: 50 | Symbol#to_s: b 51 | Symbol#size: 1 52 | Symbol#encoding: !ruby/encoding US-ASCII 53 | Value: 54 | MyStruct_1: 55 | MyStruct_1#size: 2 56 | Member 0: 57 | Name: 58 | Symbol: 59 | Symbol#to_s: c 60 | Symbol#size: 1 61 | Symbol#encoding: !ruby/encoding US-ASCII 62 | Value: Integer 4 63 | Member 1: 64 | Name: 65 | Symbol: 66 | Symbol#to_s: d 67 | Symbol#size: 1 68 | Symbol#encoding: !ruby/encoding US-ASCII 69 | Value: Integer 5 70 | ``` 71 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/nested/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | MyStruct_0 = Struct.new(:a, :b) 4 | MyStruct_1 = Struct.new(:c, :d) 5 | struct_1a = MyStruct_1.new(2, 3) 6 | struct_1b = MyStruct_1.new(4, 5) 7 | struct_0 = MyStruct_0.new(struct_1a, struct_1b) 8 | DebugHelper.show(struct_0, 'My nested struct') 9 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/nested/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | MyStruct_0 (message='My nested struct'): 3 | MyStruct_0#size: 2 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: a 8 | Symbol#size: 1 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: 11 | MyStruct_1: 12 | MyStruct_1#size: 2 13 | Member 0: 14 | Name: 15 | Symbol: 16 | Symbol#to_s: c 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 2 20 | Member 1: 21 | Name: 22 | Symbol: 23 | Symbol#to_s: d 24 | Symbol#size: 1 25 | Symbol#encoding: !ruby/encoding US-ASCII 26 | Value: Integer 3 27 | Member 1: 28 | Name: 29 | Symbol: 30 | Symbol#to_s: b 31 | Symbol#size: 1 32 | Symbol#encoding: !ruby/encoding US-ASCII 33 | Value: 34 | MyStruct_1: 35 | MyStruct_1#size: 2 36 | Member 0: 37 | Name: 38 | Symbol: 39 | Symbol#to_s: c 40 | Symbol#size: 1 41 | Symbol#encoding: !ruby/encoding US-ASCII 42 | Value: Integer 4 43 | Member 1: 44 | Name: 45 | Symbol: 46 | Symbol#to_s: d 47 | Symbol#size: 1 48 | Symbol#encoding: !ruby/encoding US-ASCII 49 | Value: Integer 5 50 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/nested/template.md: -------------------------------------------------------------------------------- 1 | #### Nested Structs 2 | 3 | This example shows nested structs. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the structs. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Struct 2 | 3 | This example shows a simple struct. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | MyStruct = Struct.new(:a, :b, :c) 10 | struct = MyStruct.new(0, 1, 2) 11 | DebugHelper.show(struct, 'My simple struct') 12 | ``` 13 | 14 | The output shows details of the struct. 15 | 16 | ```show.yaml```: 17 | ```yaml 18 | --- 19 | MyStruct (message='My simple struct'): 20 | MyStruct#size: 3 21 | Member 0: 22 | Name: 23 | Symbol: 24 | Symbol#to_s: a 25 | Symbol#size: 1 26 | Symbol#encoding: !ruby/encoding US-ASCII 27 | Value: Integer 0 28 | Member 1: 29 | Name: 30 | Symbol: 31 | Symbol#to_s: b 32 | Symbol#size: 1 33 | Symbol#encoding: !ruby/encoding US-ASCII 34 | Value: Integer 1 35 | Member 2: 36 | Name: 37 | Symbol: 38 | Symbol#to_s: c 39 | Symbol#size: 1 40 | Symbol#encoding: !ruby/encoding US-ASCII 41 | Value: Integer 2 42 | ``` 43 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | MyStruct = Struct.new(:a, :b, :c) 4 | struct = MyStruct.new(0, 1, 2) 5 | DebugHelper.show(struct, 'My simple struct') 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | MyStruct (message='My simple struct'): 3 | MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: a 8 | Symbol#size: 1 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: Integer 0 11 | Member 1: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: b 15 | Symbol#size: 1 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: Integer 1 18 | Member 2: 19 | Name: 20 | Symbol: 21 | Symbol#to_s: c 22 | Symbol#size: 1 23 | Symbol#encoding: !ruby/encoding US-ASCII 24 | Value: Integer 2 25 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Struct 2 | 3 | This example shows a simple struct. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the struct. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/struct/template.md: -------------------------------------------------------------------------------- 1 | ### Struct 2 | 3 | @[:markdown](simple/show.md) 4 | 5 | @[:markdown](mixed/show.md) 6 | 7 | @[:markdown](nested/show.md) 8 | 9 | @[:markdown](circular/show.md) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/symbol/simple/show.md: -------------------------------------------------------------------------------- 1 | #### Simple Symbol 2 | 3 | This example shows a simple symbol. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | DebugHelper.show(:lorem_ipsum, 'My symbol') 10 | ``` 11 | 12 | The output shows details of the symbol. 13 | 14 | ```show.yaml```: 15 | ```yaml 16 | --- 17 | Symbol (message='My symbol'): 18 | Symbol#to_s: lorem_ipsum 19 | Symbol#size: 11 20 | Symbol#encoding: !ruby/encoding US-ASCII 21 | ``` 22 | -------------------------------------------------------------------------------- /markdown/readme/classes/symbol/simple/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | DebugHelper.show(:lorem_ipsum, 'My symbol') 4 | -------------------------------------------------------------------------------- /markdown/readme/classes/symbol/simple/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Symbol (message='My symbol'): 3 | Symbol#to_s: lorem_ipsum 4 | Symbol#size: 11 5 | Symbol#encoding: !ruby/encoding US-ASCII 6 | -------------------------------------------------------------------------------- /markdown/readme/classes/symbol/simple/template.md: -------------------------------------------------------------------------------- 1 | #### Simple Symbol 2 | 3 | This example shows a simple symbol. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows details of the symbol. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/classes/symbol/template.md: -------------------------------------------------------------------------------- 1 | ### Symbol 2 | 3 | @[:markdown](simple/show.md) 4 | -------------------------------------------------------------------------------- /markdown/readme/classes/template.md: -------------------------------------------------------------------------------- 1 | ## Classes 2 | 3 | @[:markdown](array/template.md) 4 | 5 | @[:markdown](hash/template.md) 6 | 7 | @[:markdown](struct/template.md) 8 | 9 | @[:markdown](string/template.md) 10 | 11 | @[:markdown](symbol/template.md) 12 | 13 | -------------------------------------------------------------------------------- /markdown/readme/options/depth/show.md: -------------------------------------------------------------------------------- 1 | ### Option ```depth``` 2 | 3 | This example shows how option ```depth``` affects output. 4 | 5 | ```show.rb```: 6 | ```ruby 7 | require 'debug_helper' 8 | 9 | ary = [0, 10 | [1, 11 | [2, 12 | [3, 13 | [4] 14 | ] 15 | ] 16 | ] 17 | ] 18 | (1..5).each do |depth| 19 | message = "Show depth #{depth}" 20 | DebugHelper.show(ary, message, {:depth => depth}) 21 | end 22 | ``` 23 | 24 | The output shows output for various depths. 25 | 26 | ```show.yaml```: 27 | ```yaml 28 | --- 29 | Array (message='Show depth 1'): 30 | Array#size: 2 31 | Element 0: Integer 0 32 | Element 1: Array [1, [2, [3, [4]]]] 33 | --- 34 | Array (message='Show depth 2'): 35 | Array#size: 2 36 | Element 0: Integer 0 37 | Element 1: 38 | Array: 39 | Array#size: 2 40 | Element 0: Integer 1 41 | Element 1: Array [2, [3, [4]]] 42 | --- 43 | Array (message='Show depth 3'): 44 | Array#size: 2 45 | Element 0: Integer 0 46 | Element 1: 47 | Array: 48 | Array#size: 2 49 | Element 0: Integer 1 50 | Element 1: 51 | Array: 52 | Array#size: 2 53 | Element 0: Integer 2 54 | Element 1: Array [3, [4]] 55 | --- 56 | Array (message='Show depth 4'): 57 | Array#size: 2 58 | Element 0: Integer 0 59 | Element 1: 60 | Array: 61 | Array#size: 2 62 | Element 0: Integer 1 63 | Element 1: 64 | Array: 65 | Array#size: 2 66 | Element 0: Integer 2 67 | Element 1: 68 | Array: 69 | Array#size: 2 70 | Element 0: Integer 3 71 | Element 1: Array [4] 72 | --- 73 | Array (message='Show depth 5'): 74 | Array#size: 2 75 | Element 0: Integer 0 76 | Element 1: 77 | Array: 78 | Array#size: 2 79 | Element 0: Integer 1 80 | Element 1: 81 | Array: 82 | Array#size: 2 83 | Element 0: Integer 2 84 | Element 1: 85 | Array: 86 | Array#size: 2 87 | Element 0: Integer 3 88 | Element 1: 89 | Array: 90 | Array#size: 1 91 | Element 0: Integer 4 92 | ``` 93 | -------------------------------------------------------------------------------- /markdown/readme/options/depth/show.rb: -------------------------------------------------------------------------------- 1 | require 'debug_helper' 2 | 3 | ary = [0, 4 | [1, 5 | [2, 6 | [3, 7 | [4] 8 | ] 9 | ] 10 | ] 11 | ] 12 | (1..5).each do |depth| 13 | message = "Show depth #{depth}" 14 | DebugHelper.show(ary, message, {:depth => depth}) 15 | end 16 | -------------------------------------------------------------------------------- /markdown/readme/options/depth/show.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='Show depth 1'): 3 | Array#size: 2 4 | Element 0: Integer 0 5 | Element 1: Array [1, [2, [3, [4]]]] 6 | --- 7 | Array (message='Show depth 2'): 8 | Array#size: 2 9 | Element 0: Integer 0 10 | Element 1: 11 | Array: 12 | Array#size: 2 13 | Element 0: Integer 1 14 | Element 1: Array [2, [3, [4]]] 15 | --- 16 | Array (message='Show depth 3'): 17 | Array#size: 2 18 | Element 0: Integer 0 19 | Element 1: 20 | Array: 21 | Array#size: 2 22 | Element 0: Integer 1 23 | Element 1: 24 | Array: 25 | Array#size: 2 26 | Element 0: Integer 2 27 | Element 1: Array [3, [4]] 28 | --- 29 | Array (message='Show depth 4'): 30 | Array#size: 2 31 | Element 0: Integer 0 32 | Element 1: 33 | Array: 34 | Array#size: 2 35 | Element 0: Integer 1 36 | Element 1: 37 | Array: 38 | Array#size: 2 39 | Element 0: Integer 2 40 | Element 1: 41 | Array: 42 | Array#size: 2 43 | Element 0: Integer 3 44 | Element 1: Array [4] 45 | --- 46 | Array (message='Show depth 5'): 47 | Array#size: 2 48 | Element 0: Integer 0 49 | Element 1: 50 | Array: 51 | Array#size: 2 52 | Element 0: Integer 1 53 | Element 1: 54 | Array: 55 | Array#size: 2 56 | Element 0: Integer 2 57 | Element 1: 58 | Array: 59 | Array#size: 2 60 | Element 0: Integer 3 61 | Element 1: 62 | Array: 63 | Array#size: 1 64 | Element 0: Integer 4 65 | -------------------------------------------------------------------------------- /markdown/readme/options/depth/template.md: -------------------------------------------------------------------------------- 1 | ### Option ```depth``` 2 | 3 | This example shows how option ```depth``` affects output. 4 | 5 | @[ruby](show.rb) 6 | 7 | The output shows output for various depths. 8 | 9 | @[yaml](show.yaml) 10 | -------------------------------------------------------------------------------- /markdown/readme/show_array.rb: -------------------------------------------------------------------------------- 1 | array.each_with_index do |item, i| 2 | p [i, item] 3 | end 4 | -------------------------------------------------------------------------------- /markdown/readme/show_hash.rb: -------------------------------------------------------------------------------- 1 | hash.each_pair do |key, value| 2 | p [key, value] 3 | end 4 | -------------------------------------------------------------------------------- /markdown/readme/template.md: -------------------------------------------------------------------------------- 1 | # Debug Helper 2 | 3 | [![Gem](https://img.shields.io/gem/v/debug_helper.svg?style=flat)](http://rubygems.org/gems/debug_helper "View this project in Rubygems") 4 | 5 | ## New in Version 2.1 6 | 7 | - Handling for instances of class ```Method```. See [Method](#method). 8 | 9 | ## About Debug Helper 10 | 11 | If (like me), your debugging style is [printf debugging](https://en.wikipedia.org/wiki/Debugging#Techniques), you will have shoved this into your code many times: 12 | 13 | @[ruby](show_hash.rb) 14 | 15 | And this: 16 | 17 | @[ruby](show_array.rb) 18 | 19 | This helper assists in debugging by printing an analysis of a given object. The analysis is a ```yaml``` structure, and is written to ```stdout```. 20 | 21 | For certain classes (see below), the analysis is very detailed. 22 | 23 | For the collection classes ```Array```, ```Hash```, ```Struct```, ```Set```, and ```OpenStruct```, the analysis is also recursive; that is, the collection's values are themselves analyzed. 24 | 25 | You can control the depth of recursion using option ```depth```. See [Options](#options). 26 | 27 | Classes treated in detail: 28 | 29 | @[:markdown](class_links.md) 30 | 31 | Others are treated as: 32 | 33 | - [Object](#object) 34 | 35 | But wait, there's more! For your own classes, you can create your own handlers: 36 | 37 | - [Custom](#custom) 38 | 39 | ## Class Method or Module Method? 40 | 41 | Most examples in this documentation show use of the class method: 42 | 43 | ```ruby 44 | require 'debug_helper' 45 | DebugHelper.show(obj, message) 46 | ``` 47 | 48 | You can also choose to use the module method, ```putd``` (Thanks, [palkan](https://www.reddit.com/user/palkan)!), which looks a lot like ```puts```. 49 | 50 | ```ruby 51 | require 'debug_helper' 52 | include DebugHelper::Putd 53 | putd obj, message 54 | ``` 55 | 56 | Just be sure to ```include DebugHelper::Putd```. 57 | 58 | @[:markdown](class_inclusions.md) 59 | 60 | ## Options 61 | 62 | @[:markdown](options/depth/show.md) 63 | -------------------------------------------------------------------------------- /test/debug_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'diff-lcs' 2 | require 'ostruct' 3 | require 'pathname' 4 | require 'set' 5 | require 'tempfile' 6 | require 'yaml' 7 | 8 | require "test_helper" 9 | 10 | TEST_DIR_PATH = File.dirname(__FILE__) 11 | 12 | class DebugHelperTest < Minitest::Test 13 | 14 | include DebugHelper::Putd 15 | 16 | def test_version 17 | refute_nil ::DebugHelper::VERSION 18 | end 19 | 20 | # Classes to exercise :kind_of? in handler selection. 21 | class ArraySub < Array; end 22 | class DirSub < Dir; end 23 | class ExceptionSub < Exception; end 24 | class FileSub < File; end 25 | class IOSub < IO; end 26 | class HashSub < Hash; end 27 | class OpenStructSub < OpenStruct; end 28 | class RangeSub < Range; end 29 | class SetSub < Set; end 30 | class StringSub < String; end 31 | class StructSub < Struct; end 32 | # There's no method Symbol.new, so cannot instantiate a subclass. 33 | # class SymbolSub < Symbol; end 34 | 35 | MyStruct = Struct.new(:foo, :bar, :baz) 36 | MyStructSub = StructSub.new(:foo, :bar, :baz) 37 | 38 | def example_method(x, y, z) 39 | 40 | end 41 | 42 | def test_show 43 | 44 | array_self_referencing = [] 45 | array_self_referencing.push(array_self_referencing) 46 | 47 | array_circular_0 = [] 48 | array_circular_1 = [] 49 | array_circular_0.push(array_circular_1) 50 | array_circular_1.push(array_circular_0) 51 | 52 | hash_self_referencing_key = {} 53 | hash_self_referencing_key.store(hash_self_referencing_key, 0) 54 | 55 | hash_self_referencing_value = {} 56 | hash_self_referencing_value.store(:a, hash_self_referencing_value) 57 | 58 | hash_circular_key_0 = {} 59 | hash_circular_key_1 = {} 60 | hash_circular_key_0.store(hash_circular_key_1, 0) 61 | hash_circular_key_0.store(hash_circular_key_0, 0) 62 | 63 | hash_circular_value_0 = {} 64 | hash_circular_value_1 = {} 65 | hash_circular_value_0.store(:a, hash_circular_value_1) 66 | hash_circular_value_1.store(:b, hash_circular_value_0) 67 | 68 | ostruct_self_referencing = OpenStruct.new 69 | ostruct_self_referencing.a = ostruct_self_referencing 70 | 71 | ostruct_circular_0 = OpenStruct.new 72 | ostruct_circular_1 = OpenStruct.new 73 | ostruct_circular_0.a = ostruct_circular_1 74 | ostruct_circular_1.a = ostruct_circular_0 75 | 76 | set_self_referencing = Set.new([]) 77 | set_self_referencing.add(set_self_referencing) 78 | 79 | set_circular_0 = Set.new([]) 80 | set_circular_1 = Set.new([]) 81 | set_circular_0.add(set_circular_1) 82 | set_circular_1.add(set_circular_0) 83 | 84 | string_multiline = < [14, 22], 100 | :test_array_empty => [], 101 | :test_array_mixed_values => [14, 'foo', [0, 1], {:a => 1, :b => 1}, true, nil], 102 | :test_array_self_referencing => array_self_referencing, 103 | :test_array_circular => array_circular_0, 104 | 105 | :test_array_sub => ArraySub.new([0, 1, 2]), 106 | 107 | :test_dir => Dir.new(File.dirname(__FILE__)), 108 | 109 | :test_dir_sub => DirSub.new(File.dirname(__FILE__)), 110 | 111 | :test_hash => {:a => 14, :b => 22}, 112 | :test_hash_empty => {}, 113 | :test_hash_mixed_keys => {14 => 0, :a => 1, 'foobar' => 2}, 114 | :test_hash_mixed_values => {:a => 0, :b => '0', :c => nil}, 115 | :test_hash_self_referencing_key => hash_self_referencing_key, 116 | :test_hash_self_referencing_value => hash_self_referencing_value, 117 | :test_hash_circular_key => hash_circular_key_0, 118 | :test_hash_circular_value => hash_circular_value_0, 119 | 120 | :test_hash_sub => HashSub.new.merge(:a => 0, :b => 1), 121 | 122 | :test_io => IO.new(IO.sysopen(__FILE__, 'r'), 'r'), 123 | 124 | :test_io_sub => IOSub.new(IO.sysopen(__FILE__, 'r'), 'r'), 125 | 126 | :test_match_data => /(?.)(?.)/.match("01"), 127 | 128 | :test_method => method(:puts), 129 | 130 | :test_ostruct => OpenStruct.new(:a => 0, :b => 1, :c => 2), 131 | :test_ostruct_empty => OpenStruct.new, 132 | :test_ostruct_mixed_values => OpenStruct.new(:a => 0, :b => 'one', :c => :two), 133 | :test_ostruct_self_referencing => ostruct_self_referencing, 134 | :test_ostruct_circular => ostruct_circular_0, 135 | 136 | :test_ostruct_sub => OpenStructSub.new(:a => 0, :b => 1, :c => 2), 137 | 138 | :test_range_include_end => (0..4), 139 | :test_range_exclude_end => (0...4), 140 | 141 | :test_range_sub => RangeSub.new(0, 4), 142 | 143 | :test_regexp => /(?.)(?.)/, 144 | 145 | :test_set => Set.new([14, 22]), 146 | :test_set_empty => Set.new([]), 147 | :test_set_mixed_values => Set.new([14, 'foo', [0, 1], {:a => 1, :b => 1}, true, nil]) , 148 | :test_set_self_referencing => set_self_referencing, 149 | :test_set_circular => set_circular_0, 150 | 151 | :test_set_sub => SetSub.new([14, 22]), 152 | 153 | :test_string => 'Lorem ipsum', 154 | :test_string_empty => '', 155 | :test_string_multiline => string_multiline, 156 | :test_string_iso_8859 => 'Lorem ipsum'.encode(Encoding::ISO_8859_1), 157 | 158 | :test_string_sub => StringSub.new('Lorem ipsum'), 159 | 160 | :test_struct => MyStruct.new(0, 1, 2), 161 | :test_struct_self_referencing => struct_self_referencing, 162 | :test_struct_circular => struct_circular_0, 163 | 164 | :test_struct_sub => MyStructSub.new(0, 1, 2), 165 | 166 | :test_symbol => :lorem_ipsum, 167 | 168 | }.each_pair do |name, obj| 169 | _test_show_object(self, obj, name) 170 | end 171 | 172 | end 173 | 174 | def test_depth 175 | { 176 | :test_depth_default => { 177 | :options => {}, 178 | :obj => { 179 | :a => { 180 | :b => { 181 | :c => 'ok', 182 | } 183 | } 184 | } 185 | }, 186 | :test_depth_prune => { 187 | :options => {}, 188 | :obj => { 189 | :a => { 190 | :b => { 191 | :c => { 192 | :d => 'not ok' 193 | } 194 | } 195 | } 196 | } 197 | }, 198 | :test_depth_1 => { 199 | :options => {:depth => 1}, 200 | :obj => { 201 | :a => { 202 | :b => { 203 | :c => 'not ok', 204 | } 205 | } 206 | } 207 | } 208 | }.each_pair do |name, h| 209 | options = h[:options] 210 | obj = h[:obj] 211 | _test_show_object(self, obj, name, options) 212 | end 213 | end 214 | 215 | def _test_show(test, method, name) 216 | expected_file_path = File.join( 217 | TEST_DIR_PATH, 218 | 'show', 219 | 'expected', 220 | "#{name.to_s}.txt", 221 | ) 222 | expected_data = File.read(expected_file_path) 223 | conditioned_data = expected_data.gsub('git_dir', DebugHelperTest.git_clone_dir_path) 224 | conditioned_file = Tempfile.new("#{name.to_s}.txt") 225 | conditioned_file.write(conditioned_data) 226 | conditioned_file.close 227 | actual_file_path = File.join( 228 | TEST_DIR_PATH, 229 | 'show', 230 | 'actual', 231 | "#{name.to_s}.txt", 232 | ) 233 | yield actual_file_path 234 | diffs = DebugHelperTest.diff_files(conditioned_file.path, actual_file_path) 235 | message = "Test for #{method} with item '#{name}' failed" 236 | test.assert_empty(diffs, message) 237 | end 238 | 239 | def _test_show_object(test, obj, name, options = {}) 240 | _test_show(test, :show, name) do |actual_file_path| 241 | DebugHelperTest.write_stdout(actual_file_path) do 242 | DebugHelper.send(:show, obj, name, options) 243 | end 244 | end 245 | _test_show(test, :putd, name) do |actual_file_path| 246 | DebugHelperTest.write_stdout(actual_file_path) do 247 | putd(obj, name, options) 248 | end 249 | end 250 | end 251 | 252 | def test_show_exception 253 | def clean_file_for_exception(exception_class_name, actual_file_path) 254 | yaml = YAML.load_file(actual_file_path) 255 | top_key = yaml.keys.first 256 | values = yaml.fetch(top_key) 257 | backtrace = values.delete("#{exception_class_name}#backtrace") 258 | assert_match(File.basename(__FILE__), backtrace.first) 259 | yaml.store(top_key, values) 260 | File.write(actual_file_path, YAML.dump(yaml)) 261 | end 262 | { 263 | :test_exception => Exception, 264 | :test_exception_sub => ExceptionSub, 265 | }.each_pair do |name, klass| 266 | exception = nil 267 | begin 268 | raise klass.new('Boo!') 269 | rescue klass => exception 270 | # It's saved. 271 | end 272 | _test_show(self, :show, name) do |actual_file_path| 273 | DebugHelperTest.write_stdout(actual_file_path) do 274 | DebugHelper.send(:show, exception, name) 275 | end 276 | clean_file_for_exception(exception.class.name, actual_file_path) 277 | _test_show(self, :putd, name) do |act_file_path| 278 | DebugHelperTest.write_stdout(act_file_path) do 279 | putd(exception, name) 280 | end 281 | clean_file_for_exception(exception.class.name, actual_file_path) 282 | end 283 | end 284 | end 285 | end 286 | 287 | def test_show_object 288 | # To remove volatile values from the captured output. 289 | def clean_file_for_object(actual_file_path) 290 | yaml = YAML.load_file(actual_file_path) 291 | top_key = yaml.keys.first 292 | values = yaml.fetch(top_key) 293 | # Object ID. 294 | { 295 | :object_id => /^\d+$/, 296 | }.each_pair do |key_prefix, regexp| 297 | values.keys.each do |key| 298 | next unless key.start_with?("Object##{key_prefix}") 299 | value = values.delete(key.to_s).to_s 300 | assert_match(regexp, value) 301 | break 302 | end 303 | end 304 | yaml.store(top_key, values) 305 | File.write(actual_file_path, YAML.dump(yaml)) 306 | end 307 | name = 'test_object' 308 | object = Object.new 309 | _test_show(self, :show, name) do |actual_file_path| 310 | DebugHelperTest.write_stdout(actual_file_path) do 311 | DebugHelper.send(:show, object, name) 312 | end 313 | clean_file_for_object(actual_file_path) 314 | end 315 | _test_show(self, :putd, name) do |actual_file_path| 316 | DebugHelperTest.write_stdout(actual_file_path) do 317 | putd(object, name) 318 | end 319 | clean_file_for_object(actual_file_path) 320 | end 321 | end 322 | 323 | def test_show_file 324 | # To remove volatile values from the captured output. 325 | def clean_file_for_file(class_name, actual_file_path, test_file_path) 326 | yaml = YAML.load_file(actual_file_path) 327 | top_key = yaml.keys.first 328 | values = yaml.fetch(top_key) 329 | # Paths. 330 | { 331 | :absolute_path => /^#{test_file_path}$/, 332 | :path => /^#{test_file_path}$/, 333 | :realpath => /^#{test_file_path}$/, 334 | }.each_pair do |key_prefix, regexp| 335 | values.keys.each do |key| 336 | next unless key.start_with?("#{class_name}.#{key_prefix}(") 337 | value = values.delete(key.to_s) 338 | assert_match(regexp, value) 339 | break 340 | end 341 | end 342 | # Times. 343 | %w/ 344 | atime 345 | ctime 346 | mtime 347 | /.each do |key_prefix| 348 | values.keys.each do |key| 349 | next unless key.start_with?("#{class_name}.#{key_prefix}(") 350 | value = values.delete(key) 351 | assert_instance_of(Time, value) 352 | break 353 | end 354 | end 355 | # Size. 356 | values.keys.each do |key| 357 | next unless key.start_with?("#{class_name}.size(") 358 | value = values.delete(key) 359 | assert_equal(File.size(test_file_path), value) 360 | break 361 | end 362 | yaml.store(top_key, values) 363 | File.write(actual_file_path, YAML.dump(yaml)) 364 | end 365 | { 366 | :test_file => File, 367 | :test_file_sub => DebugHelperTest::FileSub, 368 | }.each_pair do |name, klass| 369 | file_path = __FILE__ 370 | file = klass.new(file_path) 371 | _test_show(self, :show, name) do |actual_file_path| 372 | DebugHelperTest.write_stdout(actual_file_path) do 373 | DebugHelper.send(:show, file, name) 374 | end 375 | clean_file_for_file(klass.name, actual_file_path, file_path) 376 | end 377 | _test_show(self, :putd, name) do |actual_file_path| 378 | DebugHelperTest.write_stdout(actual_file_path) do 379 | putd(file, name) 380 | end 381 | clean_file_for_file(klass.name, actual_file_path, file_path) 382 | end 383 | end 384 | end 385 | 386 | def self.write_stdout(file_path) 387 | old_stdout = $stdout 388 | $stdout = StringIO.new 389 | yield 390 | File.write(file_path, $stdout.string) 391 | ensure 392 | $stdout = old_stdout 393 | end 394 | 395 | def self.diff_files(expected_file_path, actual_file_path) 396 | diffs = nil 397 | File.open(expected_file_path) do |expected_file| 398 | expected_lines = expected_file.readlines 399 | File.open(actual_file_path) do |actual_file| 400 | actual_lines = actual_file.readlines 401 | diffs = Diff::LCS.diff(expected_lines, actual_lines) 402 | end 403 | end 404 | diffs 405 | end 406 | 407 | def self.git_clone_dir_path 408 | git_dir = `git rev-parse --git-dir`.chomp 409 | unless $?.success? 410 | message = <{:c=>"not ok"}} 9 | -------------------------------------------------------------------------------- /test/show/actual/test_depth_default.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_depth_default'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 1 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: b 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: 24 | Hash: 25 | Hash#size: 1 26 | Hash#default: 27 | Hash#default_proc: 28 | Pair 0: 29 | Key: Symbol :c 30 | Value: String "ok" 31 | -------------------------------------------------------------------------------- /test/show/actual/test_depth_prune.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_depth_prune'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 1 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: b 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: 24 | Hash: 25 | Hash#size: 1 26 | Hash#default: 27 | Hash#default_proc: 28 | Pair 0: 29 | Key: Symbol :c 30 | Value: Hash {:d=>"not ok"} 31 | -------------------------------------------------------------------------------- /test/show/actual/test_dir.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Dir (message='test_dir'): 3 | Dir#path: C:/Users/Burde/Documents/GitHub/debug_helper/test 4 | Dir.entries("C:/Users/Burde/Documents/GitHub/debug_helper/test"): 5 | - "." 6 | - ".." 7 | - debug_helper_test.rb 8 | - show 9 | - show_hash 10 | - test_helper.rb 11 | Dir.exist?("C:/Users/Burde/Documents/GitHub/debug_helper/test"): true 12 | -------------------------------------------------------------------------------- /test/show/actual/test_dir_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::DirSub (message='test_dir_sub'): 3 | DebugHelperTest::DirSub#path: C:/Users/Burde/Documents/GitHub/debug_helper/test 4 | DebugHelperTest::DirSub.entries("C:/Users/Burde/Documents/GitHub/debug_helper/test"): 5 | - "." 6 | - ".." 7 | - debug_helper_test.rb 8 | - show 9 | - show_hash 10 | - test_helper.rb 11 | DebugHelperTest::DirSub.exist?("C:/Users/Burde/Documents/GitHub/debug_helper/test"): true 12 | -------------------------------------------------------------------------------- /test/show/actual/test_exception.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Exception (message='test_exception'): 3 | Exception#message: Boo! 4 | Exception#cause: 5 | -------------------------------------------------------------------------------- /test/show/actual/test_exception_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::ExceptionSub (message='test_exception_sub'): 3 | DebugHelperTest::ExceptionSub#message: Boo! 4 | DebugHelperTest::ExceptionSub#cause: 5 | -------------------------------------------------------------------------------- /test/show/actual/test_file.txt: -------------------------------------------------------------------------------- 1 | --- 2 | File (message='test_file'): 3 | File.executable?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 4 | File.exist?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): true 5 | File.ftype("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): file 6 | File.pipe?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 7 | File.readable?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): true 8 | File.setgid?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 9 | File.setuid?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 10 | File.socket?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 11 | File.symlink?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 12 | File.writable?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): true 13 | -------------------------------------------------------------------------------- /test/show/actual/test_file_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::FileSub (message='test_file_sub'): 3 | DebugHelperTest::FileSub.executable?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 4 | DebugHelperTest::FileSub.exist?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): true 5 | DebugHelperTest::FileSub.ftype("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): file 6 | DebugHelperTest::FileSub.pipe?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 7 | DebugHelperTest::FileSub.readable?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): true 8 | DebugHelperTest::FileSub.setgid?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 9 | DebugHelperTest::FileSub.setuid?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 10 | DebugHelperTest::FileSub.socket?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 11 | DebugHelperTest::FileSub.symlink?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): false 12 | DebugHelperTest::FileSub.writable?("C:/Users/Burde/Documents/GitHub/debug_helper/test/debug_helper_test.rb"): true 13 | -------------------------------------------------------------------------------- /test/show/actual/test_hash.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash'): 3 | Hash#size: 2 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 14 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 22 20 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_circular_key.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_circular_key'): 3 | Hash#size: 2 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Hash: 9 | Hash#size: 0 10 | Hash#default: 11 | Hash#default_proc: 12 | Value: Integer 0 13 | Pair 1: 14 | Key: Hash {{}=>0, {...}=>0} 15 | Value: Integer 0 16 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_circular_value.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_circular_value'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 1 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: b 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Hash {:a=>{:b=>{...}}} 24 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_empty'): 3 | Hash#size: 0 4 | Hash#default: 5 | Hash#default_proc: 6 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_mixed_keys.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_mixed_keys'): 3 | Hash#size: 3 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: Integer 14 8 | Value: Integer 0 9 | Pair 1: 10 | Key: 11 | Symbol: 12 | Symbol#to_s: a 13 | Symbol#size: 1 14 | Symbol#encoding: !ruby/encoding US-ASCII 15 | Value: Integer 1 16 | Pair 2: 17 | Key: 18 | String: 19 | String#to_s: foobar 20 | String#size: 6 21 | String#encoding: !ruby/encoding UTF-8 22 | String#ascii_only?: true 23 | String#bytesize: 6 24 | Value: Integer 2 25 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_mixed_values.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_mixed_values'): 3 | Hash#size: 3 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 0 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: 20 | String: 21 | String#to_s: '0' 22 | String#size: 1 23 | String#encoding: !ruby/encoding UTF-8 24 | String#ascii_only?: true 25 | String#bytesize: 1 26 | Pair 2: 27 | Key: 28 | Symbol: 29 | Symbol#to_s: c 30 | Symbol#size: 1 31 | Symbol#encoding: !ruby/encoding US-ASCII 32 | Value: NilClass nil 33 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_self_referencing_key.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_self_referencing_key'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: Hash {{...}=>0} 8 | Value: Integer 0 9 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_self_referencing_value.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_self_referencing_value'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Hash {:a=>{...}} 13 | -------------------------------------------------------------------------------- /test/show/actual/test_hash_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::HashSub (message='test_hash_sub'): 3 | DebugHelperTest::HashSub#size: 2 4 | DebugHelperTest::HashSub#default: 5 | DebugHelperTest::HashSub#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 0 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 1 20 | -------------------------------------------------------------------------------- /test/show/actual/test_io.txt: -------------------------------------------------------------------------------- 1 | --- 2 | IO (message='test_io'): 3 | IO#autoclose?: true 4 | IO#binmode?: false 5 | IO#closed?: false 6 | IO#tty?: false 7 | -------------------------------------------------------------------------------- /test/show/actual/test_io_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::IOSub (message='test_io_sub'): 3 | DebugHelperTest::IOSub#autoclose?: true 4 | DebugHelperTest::IOSub#binmode?: false 5 | DebugHelperTest::IOSub#closed?: false 6 | DebugHelperTest::IOSub#tty?: false 7 | -------------------------------------------------------------------------------- /test/show/actual/test_match_data.txt: -------------------------------------------------------------------------------- 1 | --- 2 | MatchData (message='test_match_data'): 3 | MatchData#size: 3 4 | MatchData#regexp: !ruby/regexp /(?.)(?.)/ 5 | MatchData#to_a: 6 | - '01' 7 | - '0' 8 | - '1' 9 | MatchData#captures: 10 | - '0' 11 | - '1' 12 | MatchData#names: 13 | - a 14 | - b 15 | -------------------------------------------------------------------------------- /test/show/actual/test_method.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Method (message='test_method'): 3 | Method#arity: -1 4 | Method#inspect: "#" 5 | Method#name: :puts 6 | Method#original_name: :puts 7 | Method#owner: !ruby/module 'Kernel' 8 | Method#parameters: 9 | - - :rest 10 | Method#source_location: 11 | Method#super_method: 12 | -------------------------------------------------------------------------------- /test/show/actual/test_object.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Object (message='test_object'): {} 3 | -------------------------------------------------------------------------------- /test/show/actual/test_ostruct.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: Integer 1 17 | Member 2: 18 | Name: 19 | Symbol: 20 | Symbol#to_s: c 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Integer 2 24 | -------------------------------------------------------------------------------- /test/show/actual/test_ostruct_circular.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_circular'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: 10 | OpenStruct: 11 | Member 0: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: a 15 | Symbol#size: 1 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: 'OpenStruct #>>' 18 | -------------------------------------------------------------------------------- /test/show/actual/test_ostruct_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_empty'): {} 3 | -------------------------------------------------------------------------------- /test/show/actual/test_ostruct_mixed_values.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_mixed_values'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: 17 | String: 18 | String#to_s: one 19 | String#size: 3 20 | String#encoding: !ruby/encoding UTF-8 21 | String#ascii_only?: true 22 | String#bytesize: 3 23 | Member 2: 24 | Name: 25 | Symbol: 26 | Symbol#to_s: c 27 | Symbol#size: 1 28 | Symbol#encoding: !ruby/encoding US-ASCII 29 | Value: 30 | Symbol: 31 | Symbol#to_s: two 32 | Symbol#size: 3 33 | Symbol#encoding: !ruby/encoding US-ASCII 34 | -------------------------------------------------------------------------------- /test/show/actual/test_ostruct_self_referencing.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_self_referencing'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: 'OpenStruct #>' 10 | -------------------------------------------------------------------------------- /test/show/actual/test_ostruct_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::OpenStructSub (message='test_ostruct_sub'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: Integer 1 17 | Member 2: 18 | Name: 19 | Symbol: 20 | Symbol#to_s: c 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Integer 2 24 | -------------------------------------------------------------------------------- /test/show/actual/test_range_exclude_end.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Range (message='test_range_exclude_end'): 3 | Range#first: 0 4 | Range#last: 4 5 | Range#exclude_end?: true 6 | -------------------------------------------------------------------------------- /test/show/actual/test_range_include_end.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Range (message='test_range_include_end'): 3 | Range#first: 0 4 | Range#last: 4 5 | Range#exclude_end?: false 6 | -------------------------------------------------------------------------------- /test/show/actual/test_range_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::RangeSub (message='test_range_sub'): 3 | DebugHelperTest::RangeSub#first: 0 4 | DebugHelperTest::RangeSub#last: 4 5 | DebugHelperTest::RangeSub#exclude_end?: false 6 | -------------------------------------------------------------------------------- /test/show/actual/test_regexp.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Regexp (message='test_regexp'): 3 | Regexp#to_s: "(?-mix:(?.)(?.))" 4 | Regexp#casefold?: false 5 | Regexp#named_captures: 6 | a: 7 | - 1 8 | b: 9 | - 2 10 | Regexp#encoding: !ruby/encoding US-ASCII 11 | Regexp#fixed_encoding?: false 12 | -------------------------------------------------------------------------------- /test/show/actual/test_set.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set'): 3 | Set#size: 2 4 | Element 0: Integer 14 5 | Element 1: Integer 22 6 | -------------------------------------------------------------------------------- /test/show/actual/test_set_circular.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_circular'): 3 | Set#size: 1 4 | Element 0: 5 | Set: 6 | Set#size: 1 7 | Element 0: 'Set #}>}>' 8 | -------------------------------------------------------------------------------- /test/show/actual/test_set_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_empty'): 3 | Set#size: 0 4 | -------------------------------------------------------------------------------- /test/show/actual/test_set_mixed_values.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_mixed_values'): 3 | Set#size: 6 4 | Element 0: Integer 14 5 | Element 1: 6 | String: 7 | String#to_s: foo 8 | String#size: 3 9 | String#encoding: !ruby/encoding UTF-8 10 | String#ascii_only?: true 11 | String#bytesize: 3 12 | Element 2: 13 | Array: 14 | Array#size: 2 15 | Element 0: Integer 0 16 | Element 1: Integer 1 17 | Element 3: 18 | Hash: 19 | Hash#size: 2 20 | Hash#default: 21 | Hash#default_proc: 22 | Pair 0: 23 | Key: 24 | Symbol: 25 | Symbol#to_s: a 26 | Symbol#size: 1 27 | Symbol#encoding: !ruby/encoding US-ASCII 28 | Value: Integer 1 29 | Pair 1: 30 | Key: 31 | Symbol: 32 | Symbol#to_s: b 33 | Symbol#size: 1 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | Value: Integer 1 36 | Element 4: TrueClass true 37 | Element 5: NilClass nil 38 | -------------------------------------------------------------------------------- /test/show/actual/test_set_self_referencing.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_self_referencing'): 3 | Set#size: 1 4 | Element 0: 'Set #}>' 5 | -------------------------------------------------------------------------------- /test/show/actual/test_set_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::SetSub (message='test_set_sub'): 3 | DebugHelperTest::SetSub#size: 2 4 | Element 0: Integer 14 5 | Element 1: Integer 22 6 | -------------------------------------------------------------------------------- /test/show/actual/test_string.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string'): 3 | String#to_s: Lorem ipsum 4 | String#size: 11 5 | String#encoding: !ruby/encoding UTF-8 6 | String#ascii_only?: true 7 | String#bytesize: 11 8 | -------------------------------------------------------------------------------- /test/show/actual/test_string_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string_empty'): 3 | String#to_s: '' 4 | String#size: 0 5 | String#encoding: !ruby/encoding UTF-8 6 | String#ascii_only?: true 7 | String#bytesize: 0 8 | -------------------------------------------------------------------------------- /test/show/actual/test_string_iso_8859.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string_iso_8859'): 3 | String#to_s: Lorem ipsum 4 | String#size: 11 5 | String#encoding: !ruby/encoding ISO-8859-1 6 | String#ascii_only?: true 7 | String#bytesize: 11 8 | -------------------------------------------------------------------------------- /test/show/actual/test_string_multiline.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string_multiline'): 3 | String#to_s: | 4 | foobar 5 | snafu 6 | janfu 7 | String#size: 19 8 | String#encoding: !ruby/encoding UTF-8 9 | String#ascii_only?: true 10 | String#bytesize: 19 11 | -------------------------------------------------------------------------------- /test/show/actual/test_string_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::StringSub (message='test_string_sub'): 3 | DebugHelperTest::StringSub#to_s: Lorem ipsum 4 | DebugHelperTest::StringSub#size: 11 5 | DebugHelperTest::StringSub#encoding: !ruby/encoding UTF-8 6 | DebugHelperTest::StringSub#ascii_only?: true 7 | DebugHelperTest::StringSub#bytesize: 11 8 | -------------------------------------------------------------------------------- /test/show/actual/test_struct.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStruct (message='test_struct'): 3 | DebugHelperTest::MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: Integer 0 11 | Member 1: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: bar 15 | Symbol#size: 3 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: Integer 1 18 | Member 2: 19 | Name: 20 | Symbol: 21 | Symbol#to_s: baz 22 | Symbol#size: 3 23 | Symbol#encoding: !ruby/encoding US-ASCII 24 | Value: Integer 2 25 | -------------------------------------------------------------------------------- /test/show/actual/test_struct_circular.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStruct (message='test_struct_circular'): 3 | DebugHelperTest::MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: 11 | DebugHelperTest::MyStruct: 12 | DebugHelperTest::MyStruct#size: 3 13 | Member 0: 14 | Name: 15 | Symbol: 16 | Symbol#to_s: foo 17 | Symbol#size: 3 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 0 20 | Member 1: 21 | Name: 22 | Symbol: 23 | Symbol#to_s: bar 24 | Symbol#size: 3 25 | Symbol#encoding: !ruby/encoding US-ASCII 26 | Value: 'DebugHelperTest::MyStruct #, 28 | baz=2>, bar=1, baz=2>' 29 | Member 2: 30 | Name: 31 | Symbol: 32 | Symbol#to_s: baz 33 | Symbol#size: 3 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | Value: Integer 2 36 | Member 1: 37 | Name: 38 | Symbol: 39 | Symbol#to_s: bar 40 | Symbol#size: 3 41 | Symbol#encoding: !ruby/encoding US-ASCII 42 | Value: Integer 1 43 | Member 2: 44 | Name: 45 | Symbol: 46 | Symbol#to_s: baz 47 | Symbol#size: 3 48 | Symbol#encoding: !ruby/encoding US-ASCII 49 | Value: Integer 2 50 | -------------------------------------------------------------------------------- /test/show/actual/test_struct_self_referencing.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStruct (message='test_struct_self_referencing'): 3 | DebugHelperTest::MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: 'DebugHelperTest::MyStruct #, bar=1, baz=2>' 12 | Member 1: 13 | Name: 14 | Symbol: 15 | Symbol#to_s: bar 16 | Symbol#size: 3 17 | Symbol#encoding: !ruby/encoding US-ASCII 18 | Value: Integer 1 19 | Member 2: 20 | Name: 21 | Symbol: 22 | Symbol#to_s: baz 23 | Symbol#size: 3 24 | Symbol#encoding: !ruby/encoding US-ASCII 25 | Value: Integer 2 26 | -------------------------------------------------------------------------------- /test/show/actual/test_struct_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStructSub (message='test_struct_sub'): 3 | DebugHelperTest::MyStructSub#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: Integer 0 11 | Member 1: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: bar 15 | Symbol#size: 3 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: Integer 1 18 | Member 2: 19 | Name: 20 | Symbol: 21 | Symbol#to_s: baz 22 | Symbol#size: 3 23 | Symbol#encoding: !ruby/encoding US-ASCII 24 | Value: Integer 2 25 | -------------------------------------------------------------------------------- /test/show/actual/test_symbol.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Symbol (message='test_symbol'): 3 | Symbol#to_s: lorem_ipsum 4 | Symbol#size: 11 5 | Symbol#encoding: !ruby/encoding US-ASCII 6 | -------------------------------------------------------------------------------- /test/show/expected/test_array.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='test_array'): 3 | Array#size: 2 4 | Element 0: Integer 14 5 | Element 1: Integer 22 6 | -------------------------------------------------------------------------------- /test/show/expected/test_array_circular.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='test_array_circular'): 3 | Array#size: 1 4 | Element 0: 5 | Array: 6 | Array#size: 1 7 | Element 0: Array [[[...]]] 8 | -------------------------------------------------------------------------------- /test/show/expected/test_array_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='test_array_empty'): 3 | Array#size: 0 4 | -------------------------------------------------------------------------------- /test/show/expected/test_array_mixed_values.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='test_array_mixed_values'): 3 | Array#size: 6 4 | Element 0: Integer 14 5 | Element 1: 6 | String: 7 | String#to_s: foo 8 | String#size: 3 9 | String#encoding: !ruby/encoding UTF-8 10 | String#ascii_only?: true 11 | String#bytesize: 3 12 | Element 2: 13 | Array: 14 | Array#size: 2 15 | Element 0: Integer 0 16 | Element 1: Integer 1 17 | Element 3: 18 | Hash: 19 | Hash#size: 2 20 | Hash#default: 21 | Hash#default_proc: 22 | Pair 0: 23 | Key: 24 | Symbol: 25 | Symbol#to_s: a 26 | Symbol#size: 1 27 | Symbol#encoding: !ruby/encoding US-ASCII 28 | Value: Integer 1 29 | Pair 1: 30 | Key: 31 | Symbol: 32 | Symbol#to_s: b 33 | Symbol#size: 1 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | Value: Integer 1 36 | Element 4: TrueClass true 37 | Element 5: NilClass nil 38 | -------------------------------------------------------------------------------- /test/show/expected/test_array_self_referencing.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Array (message='test_array_self_referencing'): 3 | Array#size: 1 4 | Element 0: Array [[...]] 5 | -------------------------------------------------------------------------------- /test/show/expected/test_array_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::ArraySub (message='test_array_sub'): 3 | DebugHelperTest::ArraySub#size: 3 4 | Element 0: Integer 0 5 | Element 1: Integer 1 6 | Element 2: Integer 2 7 | -------------------------------------------------------------------------------- /test/show/expected/test_depth_1.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_depth_1'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: Symbol :a 8 | Value: Hash {:b=>{:c=>"not ok"}} 9 | -------------------------------------------------------------------------------- /test/show/expected/test_depth_default.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_depth_default'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 1 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: b 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: 24 | Hash: 25 | Hash#size: 1 26 | Hash#default: 27 | Hash#default_proc: 28 | Pair 0: 29 | Key: Symbol :c 30 | Value: String "ok" 31 | -------------------------------------------------------------------------------- /test/show/expected/test_depth_prune.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_depth_prune'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 1 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: b 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: 24 | Hash: 25 | Hash#size: 1 26 | Hash#default: 27 | Hash#default_proc: 28 | Pair 0: 29 | Key: Symbol :c 30 | Value: Hash {:d=>"not ok"} 31 | -------------------------------------------------------------------------------- /test/show/expected/test_dir.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Dir (message='test_dir'): 3 | Dir#path: git_dir/test 4 | Dir.entries("git_dir/test"): 5 | - "." 6 | - ".." 7 | - debug_helper_test.rb 8 | - show 9 | - show_hash 10 | - test_helper.rb 11 | Dir.exist?("git_dir/test"): true 12 | -------------------------------------------------------------------------------- /test/show/expected/test_dir_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::DirSub (message='test_dir_sub'): 3 | DebugHelperTest::DirSub#path: git_dir/test 4 | DebugHelperTest::DirSub.entries("git_dir/test"): 5 | - "." 6 | - ".." 7 | - debug_helper_test.rb 8 | - show 9 | - show_hash 10 | - test_helper.rb 11 | DebugHelperTest::DirSub.exist?("git_dir/test"): true 12 | -------------------------------------------------------------------------------- /test/show/expected/test_exception.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Exception (message='test_exception'): 3 | Exception#message: Boo! 4 | Exception#cause: 5 | -------------------------------------------------------------------------------- /test/show/expected/test_exception_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::ExceptionSub (message='test_exception_sub'): 3 | DebugHelperTest::ExceptionSub#message: Boo! 4 | DebugHelperTest::ExceptionSub#cause: 5 | -------------------------------------------------------------------------------- /test/show/expected/test_file.txt: -------------------------------------------------------------------------------- 1 | --- 2 | File (message='test_file'): 3 | File.executable?("git_dir/test/debug_helper_test.rb"): false 4 | File.exist?("git_dir/test/debug_helper_test.rb"): true 5 | File.ftype("git_dir/test/debug_helper_test.rb"): file 6 | File.pipe?("git_dir/test/debug_helper_test.rb"): false 7 | File.readable?("git_dir/test/debug_helper_test.rb"): true 8 | File.setgid?("git_dir/test/debug_helper_test.rb"): false 9 | File.setuid?("git_dir/test/debug_helper_test.rb"): false 10 | File.socket?("git_dir/test/debug_helper_test.rb"): false 11 | File.symlink?("git_dir/test/debug_helper_test.rb"): false 12 | File.writable?("git_dir/test/debug_helper_test.rb"): true 13 | -------------------------------------------------------------------------------- /test/show/expected/test_file_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::FileSub (message='test_file_sub'): 3 | DebugHelperTest::FileSub.executable?("git_dir/test/debug_helper_test.rb"): false 4 | DebugHelperTest::FileSub.exist?("git_dir/test/debug_helper_test.rb"): true 5 | DebugHelperTest::FileSub.ftype("git_dir/test/debug_helper_test.rb"): file 6 | DebugHelperTest::FileSub.pipe?("git_dir/test/debug_helper_test.rb"): false 7 | DebugHelperTest::FileSub.readable?("git_dir/test/debug_helper_test.rb"): true 8 | DebugHelperTest::FileSub.setgid?("git_dir/test/debug_helper_test.rb"): false 9 | DebugHelperTest::FileSub.setuid?("git_dir/test/debug_helper_test.rb"): false 10 | DebugHelperTest::FileSub.socket?("git_dir/test/debug_helper_test.rb"): false 11 | DebugHelperTest::FileSub.symlink?("git_dir/test/debug_helper_test.rb"): false 12 | DebugHelperTest::FileSub.writable?("git_dir/test/debug_helper_test.rb"): true 13 | -------------------------------------------------------------------------------- /test/show/expected/test_hash.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash'): 3 | Hash#size: 2 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 14 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 22 20 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_circular_key.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_circular_key'): 3 | Hash#size: 2 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Hash: 9 | Hash#size: 0 10 | Hash#default: 11 | Hash#default_proc: 12 | Value: Integer 0 13 | Pair 1: 14 | Key: Hash {{}=>0, {...}=>0} 15 | Value: Integer 0 16 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_circular_value.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_circular_value'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: 13 | Hash: 14 | Hash#size: 1 15 | Hash#default: 16 | Hash#default_proc: 17 | Pair 0: 18 | Key: 19 | Symbol: 20 | Symbol#to_s: b 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Hash {:a=>{:b=>{...}}} 24 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_empty'): 3 | Hash#size: 0 4 | Hash#default: 5 | Hash#default_proc: 6 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_mixed_keys.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_mixed_keys'): 3 | Hash#size: 3 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: Integer 14 8 | Value: Integer 0 9 | Pair 1: 10 | Key: 11 | Symbol: 12 | Symbol#to_s: a 13 | Symbol#size: 1 14 | Symbol#encoding: !ruby/encoding US-ASCII 15 | Value: Integer 1 16 | Pair 2: 17 | Key: 18 | String: 19 | String#to_s: foobar 20 | String#size: 6 21 | String#encoding: !ruby/encoding UTF-8 22 | String#ascii_only?: true 23 | String#bytesize: 6 24 | Value: Integer 2 25 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_mixed_values.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_mixed_values'): 3 | Hash#size: 3 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 0 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: 20 | String: 21 | String#to_s: '0' 22 | String#size: 1 23 | String#encoding: !ruby/encoding UTF-8 24 | String#ascii_only?: true 25 | String#bytesize: 1 26 | Pair 2: 27 | Key: 28 | Symbol: 29 | Symbol#to_s: c 30 | Symbol#size: 1 31 | Symbol#encoding: !ruby/encoding US-ASCII 32 | Value: NilClass nil 33 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_self_referencing_key.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_self_referencing_key'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: Hash {{...}=>0} 8 | Value: Integer 0 9 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_self_referencing_value.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Hash (message='test_hash_self_referencing_value'): 3 | Hash#size: 1 4 | Hash#default: 5 | Hash#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Hash {:a=>{...}} 13 | -------------------------------------------------------------------------------- /test/show/expected/test_hash_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::HashSub (message='test_hash_sub'): 3 | DebugHelperTest::HashSub#size: 2 4 | DebugHelperTest::HashSub#default: 5 | DebugHelperTest::HashSub#default_proc: 6 | Pair 0: 7 | Key: 8 | Symbol: 9 | Symbol#to_s: a 10 | Symbol#size: 1 11 | Symbol#encoding: !ruby/encoding US-ASCII 12 | Value: Integer 0 13 | Pair 1: 14 | Key: 15 | Symbol: 16 | Symbol#to_s: b 17 | Symbol#size: 1 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 1 20 | -------------------------------------------------------------------------------- /test/show/expected/test_io.txt: -------------------------------------------------------------------------------- 1 | --- 2 | IO (message='test_io'): 3 | IO#autoclose?: true 4 | IO#binmode?: false 5 | IO#closed?: false 6 | IO#tty?: false 7 | -------------------------------------------------------------------------------- /test/show/expected/test_io_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::IOSub (message='test_io_sub'): 3 | DebugHelperTest::IOSub#autoclose?: true 4 | DebugHelperTest::IOSub#binmode?: false 5 | DebugHelperTest::IOSub#closed?: false 6 | DebugHelperTest::IOSub#tty?: false 7 | -------------------------------------------------------------------------------- /test/show/expected/test_match_data.txt: -------------------------------------------------------------------------------- 1 | --- 2 | MatchData (message='test_match_data'): 3 | MatchData#size: 3 4 | MatchData#regexp: !ruby/regexp /(?.)(?.)/ 5 | MatchData#to_a: 6 | - '01' 7 | - '0' 8 | - '1' 9 | MatchData#captures: 10 | - '0' 11 | - '1' 12 | MatchData#names: 13 | - a 14 | - b 15 | -------------------------------------------------------------------------------- /test/show/expected/test_method.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Method (message='test_method'): 3 | Method#arity: -1 4 | Method#inspect: "#" 5 | Method#name: :puts 6 | Method#original_name: :puts 7 | Method#owner: !ruby/module 'Kernel' 8 | Method#parameters: 9 | - - :rest 10 | Method#source_location: 11 | Method#super_method: 12 | -------------------------------------------------------------------------------- /test/show/expected/test_object.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Object (message='test_object'): {} 3 | -------------------------------------------------------------------------------- /test/show/expected/test_ostruct.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: Integer 1 17 | Member 2: 18 | Name: 19 | Symbol: 20 | Symbol#to_s: c 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Integer 2 24 | -------------------------------------------------------------------------------- /test/show/expected/test_ostruct_circular.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_circular'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: 10 | OpenStruct: 11 | Member 0: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: a 15 | Symbol#size: 1 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: 'OpenStruct #>>' 18 | -------------------------------------------------------------------------------- /test/show/expected/test_ostruct_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_empty'): {} 3 | -------------------------------------------------------------------------------- /test/show/expected/test_ostruct_mixed_values.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_mixed_values'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: 17 | String: 18 | String#to_s: one 19 | String#size: 3 20 | String#encoding: !ruby/encoding UTF-8 21 | String#ascii_only?: true 22 | String#bytesize: 3 23 | Member 2: 24 | Name: 25 | Symbol: 26 | Symbol#to_s: c 27 | Symbol#size: 1 28 | Symbol#encoding: !ruby/encoding US-ASCII 29 | Value: 30 | Symbol: 31 | Symbol#to_s: two 32 | Symbol#size: 3 33 | Symbol#encoding: !ruby/encoding US-ASCII 34 | -------------------------------------------------------------------------------- /test/show/expected/test_ostruct_self_referencing.txt: -------------------------------------------------------------------------------- 1 | --- 2 | OpenStruct (message='test_ostruct_self_referencing'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: 'OpenStruct #>' 10 | -------------------------------------------------------------------------------- /test/show/expected/test_ostruct_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::OpenStructSub (message='test_ostruct_sub'): 3 | Member 0: 4 | Name: 5 | Symbol: 6 | Symbol#to_s: a 7 | Symbol#size: 1 8 | Symbol#encoding: !ruby/encoding US-ASCII 9 | Value: Integer 0 10 | Member 1: 11 | Name: 12 | Symbol: 13 | Symbol#to_s: b 14 | Symbol#size: 1 15 | Symbol#encoding: !ruby/encoding US-ASCII 16 | Value: Integer 1 17 | Member 2: 18 | Name: 19 | Symbol: 20 | Symbol#to_s: c 21 | Symbol#size: 1 22 | Symbol#encoding: !ruby/encoding US-ASCII 23 | Value: Integer 2 24 | -------------------------------------------------------------------------------- /test/show/expected/test_range_exclude_end.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Range (message='test_range_exclude_end'): 3 | Range#first: 0 4 | Range#last: 4 5 | Range#exclude_end?: true 6 | -------------------------------------------------------------------------------- /test/show/expected/test_range_include_end.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Range (message='test_range_include_end'): 3 | Range#first: 0 4 | Range#last: 4 5 | Range#exclude_end?: false 6 | -------------------------------------------------------------------------------- /test/show/expected/test_range_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::RangeSub (message='test_range_sub'): 3 | DebugHelperTest::RangeSub#first: 0 4 | DebugHelperTest::RangeSub#last: 4 5 | DebugHelperTest::RangeSub#exclude_end?: false 6 | -------------------------------------------------------------------------------- /test/show/expected/test_regexp.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Regexp (message='test_regexp'): 3 | Regexp#to_s: "(?-mix:(?.)(?.))" 4 | Regexp#casefold?: false 5 | Regexp#named_captures: 6 | a: 7 | - 1 8 | b: 9 | - 2 10 | Regexp#encoding: !ruby/encoding US-ASCII 11 | Regexp#fixed_encoding?: false 12 | -------------------------------------------------------------------------------- /test/show/expected/test_set.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set'): 3 | Set#size: 2 4 | Element 0: Integer 14 5 | Element 1: Integer 22 6 | -------------------------------------------------------------------------------- /test/show/expected/test_set_circular.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_circular'): 3 | Set#size: 1 4 | Element 0: 5 | Set: 6 | Set#size: 1 7 | Element 0: 'Set #}>}>' 8 | -------------------------------------------------------------------------------- /test/show/expected/test_set_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_empty'): 3 | Set#size: 0 4 | -------------------------------------------------------------------------------- /test/show/expected/test_set_mixed_values.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_mixed_values'): 3 | Set#size: 6 4 | Element 0: Integer 14 5 | Element 1: 6 | String: 7 | String#to_s: foo 8 | String#size: 3 9 | String#encoding: !ruby/encoding UTF-8 10 | String#ascii_only?: true 11 | String#bytesize: 3 12 | Element 2: 13 | Array: 14 | Array#size: 2 15 | Element 0: Integer 0 16 | Element 1: Integer 1 17 | Element 3: 18 | Hash: 19 | Hash#size: 2 20 | Hash#default: 21 | Hash#default_proc: 22 | Pair 0: 23 | Key: 24 | Symbol: 25 | Symbol#to_s: a 26 | Symbol#size: 1 27 | Symbol#encoding: !ruby/encoding US-ASCII 28 | Value: Integer 1 29 | Pair 1: 30 | Key: 31 | Symbol: 32 | Symbol#to_s: b 33 | Symbol#size: 1 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | Value: Integer 1 36 | Element 4: TrueClass true 37 | Element 5: NilClass nil 38 | -------------------------------------------------------------------------------- /test/show/expected/test_set_self_referencing.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Set (message='test_set_self_referencing'): 3 | Set#size: 1 4 | Element 0: 'Set #}>' 5 | -------------------------------------------------------------------------------- /test/show/expected/test_set_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::SetSub (message='test_set_sub'): 3 | DebugHelperTest::SetSub#size: 2 4 | Element 0: Integer 14 5 | Element 1: Integer 22 6 | -------------------------------------------------------------------------------- /test/show/expected/test_string.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string'): 3 | String#to_s: Lorem ipsum 4 | String#size: 11 5 | String#encoding: !ruby/encoding UTF-8 6 | String#ascii_only?: true 7 | String#bytesize: 11 8 | -------------------------------------------------------------------------------- /test/show/expected/test_string_empty.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string_empty'): 3 | String#to_s: '' 4 | String#size: 0 5 | String#encoding: !ruby/encoding UTF-8 6 | String#ascii_only?: true 7 | String#bytesize: 0 8 | -------------------------------------------------------------------------------- /test/show/expected/test_string_iso_8859.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string_iso_8859'): 3 | String#to_s: Lorem ipsum 4 | String#size: 11 5 | String#encoding: !ruby/encoding ISO-8859-1 6 | String#ascii_only?: true 7 | String#bytesize: 11 8 | -------------------------------------------------------------------------------- /test/show/expected/test_string_multiline.txt: -------------------------------------------------------------------------------- 1 | --- 2 | String (message='test_string_multiline'): 3 | String#to_s: | 4 | foobar 5 | snafu 6 | janfu 7 | String#size: 19 8 | String#encoding: !ruby/encoding UTF-8 9 | String#ascii_only?: true 10 | String#bytesize: 19 11 | -------------------------------------------------------------------------------- /test/show/expected/test_string_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::StringSub (message='test_string_sub'): 3 | DebugHelperTest::StringSub#to_s: Lorem ipsum 4 | DebugHelperTest::StringSub#size: 11 5 | DebugHelperTest::StringSub#encoding: !ruby/encoding UTF-8 6 | DebugHelperTest::StringSub#ascii_only?: true 7 | DebugHelperTest::StringSub#bytesize: 11 8 | -------------------------------------------------------------------------------- /test/show/expected/test_struct.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStruct (message='test_struct'): 3 | DebugHelperTest::MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: Integer 0 11 | Member 1: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: bar 15 | Symbol#size: 3 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: Integer 1 18 | Member 2: 19 | Name: 20 | Symbol: 21 | Symbol#to_s: baz 22 | Symbol#size: 3 23 | Symbol#encoding: !ruby/encoding US-ASCII 24 | Value: Integer 2 25 | -------------------------------------------------------------------------------- /test/show/expected/test_struct_circular.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStruct (message='test_struct_circular'): 3 | DebugHelperTest::MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: 11 | DebugHelperTest::MyStruct: 12 | DebugHelperTest::MyStruct#size: 3 13 | Member 0: 14 | Name: 15 | Symbol: 16 | Symbol#to_s: foo 17 | Symbol#size: 3 18 | Symbol#encoding: !ruby/encoding US-ASCII 19 | Value: Integer 0 20 | Member 1: 21 | Name: 22 | Symbol: 23 | Symbol#to_s: bar 24 | Symbol#size: 3 25 | Symbol#encoding: !ruby/encoding US-ASCII 26 | Value: 'DebugHelperTest::MyStruct #, 28 | baz=2>, bar=1, baz=2>' 29 | Member 2: 30 | Name: 31 | Symbol: 32 | Symbol#to_s: baz 33 | Symbol#size: 3 34 | Symbol#encoding: !ruby/encoding US-ASCII 35 | Value: Integer 2 36 | Member 1: 37 | Name: 38 | Symbol: 39 | Symbol#to_s: bar 40 | Symbol#size: 3 41 | Symbol#encoding: !ruby/encoding US-ASCII 42 | Value: Integer 1 43 | Member 2: 44 | Name: 45 | Symbol: 46 | Symbol#to_s: baz 47 | Symbol#size: 3 48 | Symbol#encoding: !ruby/encoding US-ASCII 49 | Value: Integer 2 50 | -------------------------------------------------------------------------------- /test/show/expected/test_struct_self_referencing.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStruct (message='test_struct_self_referencing'): 3 | DebugHelperTest::MyStruct#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: 'DebugHelperTest::MyStruct #, bar=1, baz=2>' 12 | Member 1: 13 | Name: 14 | Symbol: 15 | Symbol#to_s: bar 16 | Symbol#size: 3 17 | Symbol#encoding: !ruby/encoding US-ASCII 18 | Value: Integer 1 19 | Member 2: 20 | Name: 21 | Symbol: 22 | Symbol#to_s: baz 23 | Symbol#size: 3 24 | Symbol#encoding: !ruby/encoding US-ASCII 25 | Value: Integer 2 26 | -------------------------------------------------------------------------------- /test/show/expected/test_struct_sub.txt: -------------------------------------------------------------------------------- 1 | --- 2 | DebugHelperTest::MyStructSub (message='test_struct_sub'): 3 | DebugHelperTest::MyStructSub#size: 3 4 | Member 0: 5 | Name: 6 | Symbol: 7 | Symbol#to_s: foo 8 | Symbol#size: 3 9 | Symbol#encoding: !ruby/encoding US-ASCII 10 | Value: Integer 0 11 | Member 1: 12 | Name: 13 | Symbol: 14 | Symbol#to_s: bar 15 | Symbol#size: 3 16 | Symbol#encoding: !ruby/encoding US-ASCII 17 | Value: Integer 1 18 | Member 2: 19 | Name: 20 | Symbol: 21 | Symbol#to_s: baz 22 | Symbol#size: 3 23 | Symbol#encoding: !ruby/encoding US-ASCII 24 | Value: Integer 2 25 | -------------------------------------------------------------------------------- /test/show/expected/test_symbol.txt: -------------------------------------------------------------------------------- 1 | --- 2 | Symbol (message='test_symbol'): 3 | Symbol#to_s: lorem_ipsum 4 | Symbol#size: 11 5 | Symbol#encoding: !ruby/encoding US-ASCII 6 | -------------------------------------------------------------------------------- /test/show_hash/actual/empty.txt: -------------------------------------------------------------------------------- 1 | Label: empty 2 | Count: 0 3 | 4 | -------------------------------------------------------------------------------- /test/show_hash/actual/int_keys.txt: -------------------------------------------------------------------------------- 1 | Label: int_keys 2 | Count: 2 3 | Pair 0: 4 | Key (Fixnum) 0 5 | Value (String) "a" 6 | Pair 1: 7 | Key (Fixnum) 1 8 | Value (String) "b" 9 | 10 | -------------------------------------------------------------------------------- /test/show_hash/actual/nil_values.txt: -------------------------------------------------------------------------------- 1 | Label: nil_values 2 | Count: 2 3 | Pair 0: 4 | Key (Symbol) :a 5 | Value (NilClass) nil 6 | Pair 1: 7 | Key (Symbol) :b 8 | Value (NilClass) nil 9 | 10 | -------------------------------------------------------------------------------- /test/show_hash/actual/string_values.txt: -------------------------------------------------------------------------------- 1 | Label: string_values 2 | Count: 2 3 | Pair 0: 4 | Key (Symbol) :a 5 | Value (String) "a" 6 | Pair 1: 7 | Key (Symbol) :b 8 | Value (String) "b" 9 | 10 | -------------------------------------------------------------------------------- /test/show_hash/actual/symbol_values.txt: -------------------------------------------------------------------------------- 1 | Label: symbol_values 2 | Count: 2 3 | Pair 0: 4 | Key (Symbol) :a 5 | Value (Symbol) :a 6 | Pair 1: 7 | Key (Symbol) :b 8 | Value (Symbol) :b 9 | 10 | -------------------------------------------------------------------------------- /test/show_hash/expected/empty.txt: -------------------------------------------------------------------------------- 1 | Label: empty 2 | Count: 0 3 | 4 | -------------------------------------------------------------------------------- /test/show_hash/expected/int_keys.txt: -------------------------------------------------------------------------------- 1 | Label: int_keys 2 | Count: 2 3 | Pair 0: 4 | Key (Fixnum) 0 5 | Value (String) "a" 6 | Pair 1: 7 | Key (Fixnum) 1 8 | Value (String) "b" 9 | 10 | -------------------------------------------------------------------------------- /test/show_hash/expected/nil_values.txt: -------------------------------------------------------------------------------- 1 | Label: nil_values 2 | Count: 2 3 | Pair 0: 4 | Key (Symbol) :a 5 | Value (NilClass) nil 6 | Pair 1: 7 | Key (Symbol) :b 8 | Value (NilClass) nil 9 | 10 | -------------------------------------------------------------------------------- /test/show_hash/expected/string_values.txt: -------------------------------------------------------------------------------- 1 | Label: string_values 2 | Count: 2 3 | Pair 0: 4 | Key (Symbol) :a 5 | Value (String) "a" 6 | Pair 1: 7 | Key (Symbol) :b 8 | Value (String) "b" 9 | 10 | -------------------------------------------------------------------------------- /test/show_hash/expected/symbol_values.txt: -------------------------------------------------------------------------------- 1 | Label: symbol_values 2 | Count: 2 3 | Pair 0: 4 | Key (Symbol) :a 5 | Value (Symbol) :a 6 | Pair 1: 7 | Key (Symbol) :b 8 | Value (Symbol) :b 9 | 10 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 2 | require 'debug_helper' 3 | 4 | require "minitest/autorun" 5 | --------------------------------------------------------------------------------