All Projects → jbodah → Suggest_rb

jbodah / Suggest_rb

❓ tells you which method does the thing you want to do

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Suggest rb

Cargo Modules
A cargo plugin for showing a tree-like overview of a crate's modules.
Stars: ✭ 222 (-10.84%)
Mutual labels:  developer-tools
Opentouryo
”Open棟梁”は、長年の.NETアプリケーション開発実績にて蓄積したノウハウに基づき開発した.NET用アプリケーション フレームワークです。 (”OpenTouryo” , is an application framework for .NET which was developed using the accumulated know-how with a long track record in .NET application development.)
Stars: ✭ 233 (-6.43%)
Mutual labels:  developer-tools
Dojo
Containerize your development and operations environment
Stars: ✭ 240 (-3.61%)
Mutual labels:  developer-tools
Awesome Ci
List of Continuous Integration services
Stars: ✭ 2,737 (+999.2%)
Mutual labels:  developer-tools
Audion
Audion (Web Audio Inspector) is a Chrome extension that adds a Web Audio panel to Developer Tools. This panel visualizes the web audio graph in real-time and lets users inspect nodes.
Stars: ✭ 230 (-7.63%)
Mutual labels:  developer-tools
Monocorpus
A notepad for software and machine learning
Stars: ✭ 234 (-6.02%)
Mutual labels:  developer-tools
Dev Tools
The most popular software developer tools in one app
Stars: ✭ 221 (-11.24%)
Mutual labels:  developer-tools
Frontend Webpack Boilerplate
Simple starter webpack 5 project template supporting SASS/PostCSS, Babel ES7, browser syncing, code linting. Easy project setup having multiple features and developer friendly tools.
Stars: ✭ 242 (-2.81%)
Mutual labels:  developer-tools
Docker Mastery For Nodejs
Docker Mastery for Node.js Projects, From a Docker Captain
Stars: ✭ 231 (-7.23%)
Mutual labels:  developer-tools
Puppeteer Examples
Puppeteer example scripts for running Headless Chrome from Node.
Stars: ✭ 2,781 (+1016.87%)
Mutual labels:  developer-tools
Rested
A REST client for browsers
Stars: ✭ 225 (-9.64%)
Mutual labels:  developer-tools
Hack
A typeface designed for source code
Stars: ✭ 14,543 (+5740.56%)
Mutual labels:  developer-tools
React Sight
Visualization tool for React, with support for Fiber, Router (v4), and Redux
Stars: ✭ 2,716 (+990.76%)
Mutual labels:  developer-tools
Devutils App
Offline Toolbox for Developers
Stars: ✭ 2,735 (+998.39%)
Mutual labels:  developer-tools
See
Python's dir() for humans. (GitHub mirror)
Stars: ✭ 240 (-3.61%)
Mutual labels:  developer-tools
Rustplayground
Quickly test Rust code on macOS
Stars: ✭ 222 (-10.84%)
Mutual labels:  developer-tools
Wakapi
📊 A minimalist, self-hosted WakaTime-compatible backend for coding statistics
Stars: ✭ 232 (-6.83%)
Mutual labels:  developer-tools
Contrib
Data for dev.tube – 🍿 a free and open-source tech video hub.
Stars: ✭ 247 (-0.8%)
Mutual labels:  developer-tools
Hex
🔮 Futuristic take on hexdump, made in Rust.
Stars: ✭ 242 (-2.81%)
Mutual labels:  developer-tools
Review
🎨 A view to help developers and designers view the View's font size, color, and border.
Stars: ✭ 236 (-5.22%)
Mutual labels:  developer-tools

Suggest

tells you which method does the thing you want to do

Disclaimer

I don't recommend you ship this in your Gemfile. Keep it in your system's gems (e.g. gem install) and load it as needed (e.g. irb -rsuggest, RUBY_OPT=-rsuggest irb, etc)

Installation

gem install suggest_rb

Usage

require 'suggest'

# Object#what_returns? tells you which method returns the value
[1,2,3].what_returns? 1
=> [:first, :min]

# You can also specify the args you want that method to take
[1,2,3].what_returns? [1], args: [1]
=> [:first, :take, :grep, :min]

# By default, it only returns methods that don't mutate the object
[1,2,3].what_returns? [1], args: [1], allow_mutation: true
=> [:first, :take, :shift, :grep, :min]

# It works on several core modules including String
"HELLO".what_returns? "hello"
=> [:downcase, :swapcase]

# You can also specify a block that you want the method to accept
[1,2,3,4].what_returns?({true => [2,4], false => [1,3]}) { |n| n % 2 == 0 }
=> [:group_by]

# Object#what_mutates? tells you which method changes the object to the desired state
[1,2,3].what_mutates? [2, 3]
=> [:shift]

# You can also match on the return value
[1,2,3].what_mutates? [2, 3], returns: 1
=> [:shift]

[1,2,3].what_mutates? [2, 3], returns: 2
=> []

# You can specify which args to pass to the method
[1,2,3].what_mutates? [3], args: [2]
=> [:shift]

# It also works on a bunch of core modules
"HELLO".what_mutates? "hello"
=> [:swapcase!, :downcase!]

# And you can give it a block as well
[1,2,3,4].what_mutates? [2,4] { |n| n % 2 == 0 }
=> [:select!, :keep_if]

# You can use a lambda as an expected
[1,2,3,4].what_returns? -> (something_that) { something_that.to_i == 4 }
=> [:count, :length, :size, :last, :max]

# It respects the ruby version
# ruby 2.4.3
{a: 1, b: 2}.what_returns?({})
=> []
# ruby 2.5.0
{a: 1, b: 2}.what_returns?({})
=> [:slice]

Note to Self

Snippet to use in bin/console for finding methods for blacklisting:

Suggest::SUGGEST_MODS.flat_map { |k| [k].product(k.instance_methods) }.select { |k, v| v == :rand }.map { |k, v| k.instance_method(v).owner }.uniq
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].