Skip to content

Commit c3ac288

Browse files
committed
Remove s:function(), which is unnecessary on Vim 8
1 parent 959e94b commit c3ac288

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

autoload/rails.vim

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ let s:readable_prototype = {}
1717

1818
function! s:add_methods(namespace, method_names)
1919
for name in a:method_names
20-
let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name)
20+
let s:{a:namespace}_prototype[name] = function('s:'.a:namespace.'_'.name)
2121
endfor
2222
endfunction
2323

24-
function! s:function(name) abort
25-
return function(substitute(a:name, '^s:', matchstr(expand('<sfile>'), '.*\zs<SNR>\d\+_'), ''))
26-
endfunction
27-
2824
function! s:sub(str,pat,rep)
2925
return substitute(a:str,'\v\C'.a:pat,a:rep,'')
3026
endfunction
@@ -446,7 +442,7 @@ call s:add_methods('readable',['end_of','last_opening_line','last_method_line','
446442
function! s:readable_find_affinity() dict abort
447443
let f = self.name()
448444
let all = self.app().projections()
449-
for pattern in reverse(sort(filter(keys(all), 'v:val =~# "^[^*{}]*\\*[^*{}]*$"'), s:function('rails#lencmp')))
445+
for pattern in reverse(sort(filter(keys(all), 'v:val =~# "^[^*{}]*\\*[^*{}]*$"'), function('rails#lencmp')))
450446
if !has_key(all[pattern], 'affinity')
451447
continue
452448
endif
@@ -3128,7 +3124,7 @@ function! s:readable_resolve_view(name, ...) dict abort
31283124
else
31293125
for format in ['.'.self.format(a:0 ? a:1 : 0), '']
31303126
let found = self.app().relglob('', 'app/views/'.name.format.'.*')
3131-
call sort(found, s:function('s:dotcmp'))
3127+
call sort(found, function('s:dotcmp'))
31323128
if !empty(found)
31333129
return self.app().path(found[0])
31343130
endif
@@ -4789,7 +4785,7 @@ function! s:readable_projected_with_raw(key, ...) dict abort
47894785
if has_key(all, f)
47904786
let mine += map(s:getlist(all[f], a:key), '[s:expand_placeholders(v:val, a:0 ? a:1 : {}), v:val]')
47914787
endif
4792-
for pattern in reverse(sort(filter(keys(all), 'v:val =~# "^[^*{}]*\\*[^*{}]*$"'), s:function('rails#lencmp')))
4788+
for pattern in reverse(sort(filter(keys(all), 'v:val =~# "^[^*{}]*\\*[^*{}]*$"'), function('rails#lencmp')))
47934789
let [prefix, suffix; _] = split(pattern, '\*', 1)
47944790
if s:startswith(f, prefix) && s:endswith(f, suffix)
47954791
let root = f[strlen(prefix) : -strlen(suffix)-1]

plugin/rails.vim

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ let g:db_adapter_rails = 'rails#db_'
151151
" }}}1
152152
" abolish.vim support {{{1
153153

154-
function! s:function(name)
155-
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
156-
endfunction
157-
158154
augroup railsPluginAbolish
159155
autocmd!
160156
autocmd VimEnter * call s:abolish_setup()
@@ -163,10 +159,10 @@ augroup END
163159
function! s:abolish_setup()
164160
if exists('g:Abolish') && has_key(g:Abolish,'Coercions')
165161
if !has_key(g:Abolish.Coercions,'l')
166-
let g:Abolish.Coercions.l = s:function('s:abolish_l')
162+
let g:Abolish.Coercions.l = function('s:abolish_l')
167163
endif
168164
if !has_key(g:Abolish.Coercions,'t')
169-
let g:Abolish.Coercions.t = s:function('s:abolish_t')
165+
let g:Abolish.Coercions.t = function('s:abolish_t')
170166
endif
171167
endif
172168
endfunction

0 commit comments

Comments
 (0)