owen
April 12, 2021, 10:15am
1
Similar to @type.instance_vars
I would like to get all local vars from a block/method, sample:
macro print_local_vars
var1 = 10
var2 = "Sample var"
{% puts @type.local_variables %}
end
print_local_vars() # ==> should print { var1 => 10, var2 => "Sample var" }
This is currently impossible. It could probably be implemented, but I don’t see an immediate use case.
What do you want to do with that?
owen
April 12, 2021, 12:54pm
4
Hey @straight-shoota
My idea is to improve icr library to save all local variables from previous commands, more details in this comment (wanted to have a better REPL alternative very important for Ruby developers):
opened 12:40PM - 10 Apr 21 UTC
Hi,
I am using this cli with Amber and having the following:
$ icr
$icr > require "./config/application.cr"
$icr > Article.count ==> 0
$icr > Article.create(title:...
question
Thanks for answering my question.
1 Like