Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

system_navigation

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

system_navigation

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

SystemNavigation

  • Repository
  • Documentation

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:

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.

module M
  def increment
    @num + 1
  end
end

class A
  include M

  attr_reader :num

  def initialize(num)
    @num = num
  end
end

sn = SystemNavigation.default

sn.all_accesses(to: :@num, from: A)
#=> [#<UnboundMethod: A#num>, #<UnboundMethod: A(M)#increment>, #<UnboundMethod: A#initialize>]
#all_implementors_of

Find all classes and modules that implement the given message.

sn = SystemNavigation.default

sn.all_implementors_of(:puts)
#=> [ARGF.class, IO, Kernel, ..., YARD::Logger]
#all_calls

Find all methods in Bundler that invoke the 1 literal.

require 'bundler'

sn = SystemNavigation.default

sn.all_calls(on: 1, gem: 'bundler')
#=> [#<UnboundMethod: #<Class:Bundler>#with_clean_env>, #<UnboundMethod: #<Class:Bundler>#eval_gemspec>]
#all_objects

Retrieve all objects defined in the system.

sn = SystemNavigation.default

sn.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.

FAQs

Package last updated on 24 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc