Skip to content
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
wants to merge 6 commits into from
Closed

Conversation

ichizok
Copy link
Contributor

@ichizok ichizok commented Mar 22, 2019

Examples:

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?

@brammool
Copy link
Contributor

brammool commented Mar 23, 2019 via email

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Othet → Other

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, fixed it.

@ichizok
Copy link
Contributor Author

ichizok commented Mar 26, 2019

Updated patch: Add more tests for "ruby print" in Test_print (test_ruby).

@brammool brammool closed this in e99be0e Mar 26, 2019
@ichizok ichizok deleted the feature/rubyeval branch March 26, 2019 22:03
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants