Comments (3)
@greyblake please re-open, it's possible with macros!
Something like ls String
could do a pp {{ String.methods.map(&.name.stringify) }}
to list all methods name.
It's a very basic example, but you can get other information on each method (it's signature, body, etc..) with some more macro code :)
from icr.
Hey.
Thanks for the suggestion.
At the moment it won't be possible to have, because Crystal does not have such reflection mechanisms like Ruby has, e.g. methods, like Object#methods
, Object#instance_variables
, etc.
I'll close the issue for now.
Please reopen it, if you have an idea how this could be achieved.
from icr.
Doing some ruby now, and actually used ls
on an ActiveRecord object, it's pretty cool in pry!!!
About ls
for icr
, would be nice to have:
ls String
: to show all methods defined inString
(but not inComparable
/Object
)ls -a String
(or similar, with a crystal syntax): to show all available methods inString
, including methods from included modules, base classes, etc.. (Comparable
/Object
/Reference
...)
With full methods signature, and maybe a mention when the method is generated from a macro (not possible yet from macros, but maybe we can find a workaround)
from icr.
Related Issues (20)
- Error target icr failed to compile: HOT 1
- can't find file 'prelude' HOT 1
- build failure (opensuse)
- yaml is nedded HOT 2
- icr on Mac Mojave HOT 10
- does not work on freebsd HOT 2
- Crashes when path contains spaces HOT 1
- Crystal 0.32.0 breaks icr HOT 2
- Syntax error with `true.!` expression HOT 1
- Wrong version defined in shard.yml HOT 2
- Feature: magic help comment HOT 1
- Error on exit/quit HOT 3
- Re runs all previous commands generates unexpected results HOT 6
- Current version HOT 13
- Add postinstall script to build to bin
- Issue was with amber framework and has been raised there
- ld: library not found for -lssl (this usually means you need to install the development package for libssl) HOT 2
- Accepts one character & then hangs HOT 3
- LICENSE HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icr.