README.md in object_inspector-0.6.2 vs README.md in object_inspector-0.6.3

- old
+ new

@@ -1,12 +1,11 @@ -# ObjectInspector +# Object Inspector [![Gem Version](https://badge.fury.io/rb/object_inspector.svg)](https://badge.fury.io/rb/object_inspector) -[![Test Coverage](https://api.codeclimate.com/v1/badges/34e821263d9e0c33d536/test_coverage)](https://codeclimate.com/github/pdobb/object_inspector/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/34e821263d9e0c33d536/maintainability)](https://codeclimate.com/github/pdobb/object_inspector/maintainability) -ObjectInspector takes Object#inspect to the next level. Specify any combination of identification attributes, flags, issues, info, and/or a name along with an optional, self-definable scope option to represent objects. Great for the console, logging, etc. +Object Inspector takes Object#inspect to the next level. Specify any combination of identification attributes, flags, issues, info, and/or a name along with an optional, self-definable scope option to represent objects. Great for the console, logging, etc. Why? Because object inspection code should be uniform, easy to build, and its output should be easy to read! If you'd like to just jump into an example: [Full Example](#full-example). @@ -29,24 +28,21 @@ ## Compatibility Tested MRI Ruby Versions: -* 2.3 -* 2.4 -* 2.5 -* 2.6 * 2.7 +* 3.0 * 3.1 * 3.2 -ObjectInspector has no other dependencies. +Object Inspector has no other dependencies. ## Configuration -Global/default values for ObjectInspector can be configured via the ObjectInspector::Configuration object. +Global/default values for Object Inspector can be configured via the ObjectInspector::Configuration object. _Note: In a Rails app, the following would go in e.g. `config/initializers/object_inspector.rb`_ ```ruby # Default values are shown. @@ -391,17 +387,17 @@ def initialize(my_object) @my_object = my_object end - def inspect(**kargs) + def inspect(**kwargs) super(identification: self.class.name, name: nil, flags: nil, info: nil, issues: nil, - **kargs) + **kwargs) end def to_model @my_object end @@ -511,11 +507,11 @@ - [ObjectInspector::CombiningFormatter] ## Supporting Gems -ObjectInspector works great with the [ObjectIdentifier](https://github.com/pdobb/object_identifier) gem. +Object Inspector works great with the [Object Identifier](https://github.com/pdobb/object_identifier) gem. ```ruby class MyObject include ObjectInspector::InspectorsHelper @@ -544,32 +540,32 @@ ``` ## Performance -### Benchmarking ObjectInspector +### Benchmarking Object Inspector ObjectInspetor is ~4x slower than Ruby's default inspect. -Performance of ObjectInspect can be tested by playing the [ObjectInspector Benchmarking Scripts] in the pry console for this gem. +Performance of Object Inspector can be tested by playing the [Object Inspector Benchmarking Script](https://github.com/pdobb/object_inspector/blob/master/script/benchmarking/object_inspector.rb) in the pry console for this gem. ```ruby -play scripts/benchmarking/object_inspector.rb +play script/benchmarking/object_inspector.rb # Comparison: # Ruby: 30382.2 i/s # ObjectInspector::Inspector: 7712.2 i/s - 3.94x slower ``` ### Benchmarking Formatters [ObjectInspector::TemplatingFormatter] -- which is the default Formatter -- outperforms [ObjectInspector::CombiningFormatter] by about 30% on average. -Performance of Formatters can be tested by playing the [Formatters Benchmarking Scripts] in the pry console for this gem. +Performance of Formatters can be tested by playing the [Formatters Benchmarking Scripts](https://github.com/pdobb/object_inspector/blob/master/script/benchmarking/formatters.rb) in the pry console for this gem. ```ruby -play scripts/benchmarking/formatters.rb +play script/benchmarking/formatters.rb # == Averaged ============================================================= # ... # # Comparison: # ObjectInspector::TemplatingFormatter: 45725.3 i/s @@ -584,11 +580,11 @@ Custom Formatters may be similarly gauged for comparison by adding them to the `custom_formatter_klasses` array before playing the script. ```ruby custom_formatter_klasses = [MyCustomFormatter] -play scripts/benchmarking/formatters.rb +play script/benchmarking/formatters.rb # == Averaged ============================================================= # ... # # Comparison: # MyCustomFormatter: 52001.2 i/s @@ -599,17 +595,25 @@ ``` ## Development -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. Or, run `rake` to run the tests plus linters as well as `yard` (to confirm proper YARD documentation practices). You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. -To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). +To release a new version, update the version number in `version.rb`, bump the latest ruby target versions etc. with `rake bump`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). +### Documentation +[YARD documentation](https://yardoc.org/index.html) can be generated and viewed live: +1. Install YARD: `gem install yard` +2. Run the YARD server: `yard server --reload` +3. Open the live documentation site: `open http://localhost:8808` + +While the YARD server is running, documentation in the live site will be auto-updated on source code save (and site reload). + ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/pdobb/object_inspector. @@ -618,7 +622,7 @@ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). [ObjectInspector::TemplatingFormatter]: https://github.com/pdobb/object_inspector/blob/master/lib/object_inspector/formatters/templating_formatter.rb [ObjectInspector::CombiningFormatter]: https://github.com/pdobb/object_inspector/blob/master/lib/object_inspector/formatters/combining_formatter.rb -[ObjectInspector Benchmarking Scripts]: https://github.com/pdobb/object_inspector/blob/master/scripts/benchmarking/object_inspector.rb -[Formatters Benchmarking Scripts]: https://github.com/pdobb/object_inspector/blob/master/scripts/benchmarking/formatters.rb +[Object Inspector Benchmarking Scripts]: https://github.com/pdobb/object_inspector/blob/master/script/benchmarking/object_inspector.rb +[Formatters Benchmarking Scripts]: https://github.com/pdobb/object_inspector/blob/master/script/benchmarking/formatters.rb