Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyrylo/system_navigation
A library that provides additional introspection capabilities for Ruby programs
https://github.com/kyrylo/system_navigation
Last synced: 3 days ago
JSON representation
A library that provides additional introspection capabilities for Ruby programs
- Host: GitHub
- URL: https://github.com/kyrylo/system_navigation
- Owner: kyrylo
- License: zlib
- Created: 2015-05-17T23:03:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-08T22:49:29.000Z (over 9 years ago)
- Last Synced: 2024-12-24T13:23:08.757Z (12 days ago)
- Language: Ruby
- Homepage: http://www.rubydoc.info/gems/system_navigation/SystemNavigation
- Size: 349 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
SystemNavigation
==* [Repository](https://github.com/kyrylo/system_navigation/)
* [Documentation](http://www.rubydoc.info/gems/system_navigation)Description
-----------SystemNavigation is a Ruby library that provides additional introspection
capabilities for Ruby programs. The library defines a number of useful methods
that allow querying:* methods for instance, class or global variables
* methods for literals such as numbers, strings, symbols, etc.
* methods for finding a specific string (method source search)
* classes and modules that implement given methods
* classes and modules that send messages
* all classes and modules in gems
* and many more...For the complete list of features please read the documentation or _read the
tests_. All interaction with the library is done via the `SystemNavigation`
class and its class methods. The description of the methods can be found in
these places:* [SystemNavigation](http://www.rubydoc.info/gems/system_navigation/SystemNavigation)
* [SystemNavigation::RubyEnvironment](http://www.rubydoc.info/gems/system_navigation/SystemNavigation/RubyEnvironment)Examples (full list in the documentation)
--##### #all_accesses
Retrieve all methods that access instance variables in the given class/module
including its ancestors and children.```ruby
module M
def increment
@num + 1
end
endclass A
include Mattr_reader :num
def initialize(num)
@num = num
end
endsn = SystemNavigation.default
sn.all_accesses(to: :@num, from: A)
#=> [#, #, #]
```##### #all_implementors_of
Find all classes and modules that implement the given message.
```ruby
sn = SystemNavigation.defaultsn.all_implementors_of(:puts)
#=> [ARGF.class, IO, Kernel, ..., YARD::Logger]
```##### #all_calls
Find all methods in Bundler that invoke the `1` literal.
```ruby
require 'bundler'sn = SystemNavigation.default
sn.all_calls(on: 1, gem: 'bundler')
#=> [##with_clean_env>, ##eval_gemspec>]
```##### #all_objects
Retrieve all objects defined in the system.
```ruby
sn = SystemNavigation.defaultsn.all_objects.map(&:class).uniq.count #=> 158
```And many more...
Installation
------------All you need is to install the gem.
gem install system_navigation
Limitations
-----------Supports *only* CRuby.
* CRuby 2.2.2 and higher
Credits
-------* Inspired by Smalltalk
License
-------The project uses Zlib License. See LICENCE.txt file for more information.