-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if_ruby: Add rubyeval() function #4152
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ozaki Kiichi wrote:
Examples:
```vim
echo rubyeval('true')
" v:true
echo rubyeval('false')
" v:false
echo rubyeval('nil')
" v:null
echo rubyeval('123')
" 123
echo rubyeval('"str"')
" 'str'
echo rubyeval(':sym')
" 'sym'
echo rubyeval('[0,1,2]')
" [0,1,2]
echo rubyeval('{"key" => "val"}')
" {'key': 'val'}
" Other objects: return the result of `Object#to_s`
echo rubyeval('Vim')
" 'Vim'
echo rubyeval('Vim.class')
" 'Module'
```
This pull-req, vim converts ruby objects which cannot correspond naturally to vim objects to strings resulted from "Object#to_s".
Or, is it better to (not convert and) raise conversion error?
Thanks, looks good.
In the tests you replaced RubyEval() with rubyeval(). That means the
form with ":ruby print {expr}" is no longer tested. I think we should
test both, since the results are not exactly the same.
Can you please Keep the RubEval() lines and add the rubyeval() lines?
Perhaps with some convenient function to reduce the number of lines. It
would take the expression and the value that RubEval() is expected to
return and a value that rubyeval() is expected to return.
…--
hundred-and-one symptoms of being an internet addict:
102. When filling out your driver's license application, you give
your IP address.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
dpelle
reviewed
Mar 23, 2019
runtime/doc/eval.txt
Outdated
are copied though). | ||
Arrays are represented as Vim |List| type. | ||
Hashes are represented as Vim |Dictionary| type. | ||
Othet objects are represented as strings resulted from their |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Othet → Other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, fixed it.
Updated patch: Add more tests for "ruby print" in Test_print (test_ruby). |
alexgenco
added a commit
to alexgenco/neovim
that referenced
this pull request
Oct 20, 2020
Problem: No eval function for Ruby. Solution: Add rubyeval(). (Ozaki Kiichi, closes vim/vim#4152) vim/vim@e99be0e
alexgenco
added a commit
to alexgenco/neovim
that referenced
this pull request
Oct 21, 2020
Problem: No eval function for Ruby. Solution: Add rubyeval(). (Ozaki Kiichi, closes vim/vim#4152) vim/vim@e99be0e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Examples:
This pull-req, vim converts ruby objects which cannot correspond naturally to vim objects to strings resulted from "Object#to_s".
Or, is it better to (not convert and) raise conversion error?