diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-03-26 22:51:09 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-03-26 22:51:09 +0100 |
commit | e99be0e6d28fad96efd2b2be23fa38e7559e80e1 (patch) | |
tree | ba47feb515238f5e77526bce8320d2ed33f1a1e5 /runtime | |
parent | 75bf3d22f42684beecd977f3185e98045b5c33d9 (diff) |
patch 8.1.1056: no eval function for Rubyv8.1.1056
Problem: No eval function for Ruby.
Solution: Add rubyeval(). (Ozaki Kiichi, closes #4152)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 12 | ||||
-rw-r--r-- | runtime/doc/if_ruby.txt | 14 |
2 files changed, 24 insertions, 2 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 1294481daf..db63a22990 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2521,6 +2521,7 @@ repeat({expr}, {count}) String repeat {expr} {count} times resolve({filename}) String get filename a shortcut points to reverse({list}) List reverse {list} in-place round({expr}) Float round off {expr} +rubyeval({expr}) any evaluate |Ruby| expression screenattr({row}, {col}) Number attribute at screen position screenchar({row}, {col}) Number character at screen position screencol() Number current cursor column @@ -7432,6 +7433,17 @@ round({expr}) *round()* < -5.0 {only available when compiled with the |+float| feature} +rubyeval({expr}) *rubyeval()* + Evaluate Ruby expression {expr} and return its result + converted to Vim data structures. + Numbers, floats and strings are returned as they are (strings + are copied though). + Arrays are represented as Vim |List| type. + Hashes are represented as Vim |Dictionary| type. + Other objects are represented as strings resulted from their + "Object#to_s" method. + {only available when compiled with the |+ruby| feature} + screenattr({row}, {col}) *screenattr()* Like |screenchar()|, but return the attribute. This is a rather arbitrary number that can only be used to compare to the diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index a98b6209e6..e2e7742151 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -11,7 +11,8 @@ The Ruby Interface to Vim *ruby* *Ruby* 3. Vim::Buffer objects |ruby-buffer| 4. Vim::Window objects |ruby-window| 5. Global variables |ruby-globals| -6. Dynamic loading |ruby-dynamic| +6. rubyeval() Vim function |ruby-rubyeval| +7. Dynamic loading |ruby-dynamic| {Vi does not have any of these commands} *E266* *E267* *E268* *E269* *E270* *E271* *E272* *E273* @@ -198,7 +199,16 @@ $curwin The current window object. $curbuf The current buffer object. ============================================================================== -6. Dynamic loading *ruby-dynamic* +6. rubyeval() Vim function *ruby-rubyeval* + +To facilitate bi-directional interface, you can use |rubyeval()| function to +evaluate Ruby expressions and pass their values to Vim script. + +The Ruby value "true", "false" and "nil" are converted to v:true, v:false and +v:null, respectively. + +============================================================================== +7. Dynamic loading *ruby-dynamic* On MS-Windows and Unix the Ruby library can be loaded dynamically. The |:version| output then includes |+ruby/dyn|. |