@@ -413,9 +413,9 @@ endfunction
413413
414414function ! s: buffer_getline (... ) dict abort
415415 if a: 0 == 1
416- return get (call (' getbufline' ,[self ._number ]+ a: 000 ),0 ,' ' )
416+ return get (call (' getbufline' ,[self .number () ]+ a: 000 ),0 ,' ' )
417417 else
418- return call (' getbufline' ,[self ._number ]+ a: 000 )
418+ return call (' getbufline' ,[self .number () ]+ a: 000 )
419419 endif
420420endfunction
421421
@@ -460,11 +460,11 @@ function! s:debug(str)
460460endfunction
461461
462462function ! s: buffer_getvar (varname) dict abort
463- return getbufvar (self ._number ,a: varname )
463+ return getbufvar (self .number () ,a: varname )
464464endfunction
465465
466466function ! s: buffer_setvar (varname, val) dict abort
467- return setbufvar (self ._number ,a: varname ,a: val )
467+ return setbufvar (self .number () ,a: varname ,a: val )
468468endfunction
469469
470470call s: add_methods (' buffer' ,[' getvar' ,' setvar' ])
@@ -528,7 +528,7 @@ function! rails#app(...)
528528endfunction
529529
530530function ! rails#buffer (... )
531- return extend (extend ({' _number ' : bufnr (a: 0 ? a: 1 : ' %' )},s: buffer_prototype ,' keep' ),s: readable_prototype ,' keep' )
531+ return extend (extend ({' # ' : bufnr (a: 0 ? a: 1 : ' %' )},s: buffer_prototype ,' keep' ),s: readable_prototype ,' keep' )
532532 endif
533533endfunction
534534
@@ -568,16 +568,17 @@ function! s:file_name() dict abort
568568 return self ._name
569569endfunction
570570
571+ function ! s: buffer_number () dict abort
572+ return self [' #' ]
573+ endfunction
574+
571575function ! s: buffer_path () dict abort
572- return s: gsub (fnamemodify (bufname (self ._number ),' :p' ),' \\ @!' ,' /' )
576+ return s: gsub (fnamemodify (bufname (self .number () ),' :p' ),' \\ @!' ,' /' )
573577endfunction
574578
575579function ! s: buffer_name () dict abort
576580 let app = self .app ()
577- if getbufvar (self ._number,' rails_file_type' ) != ' '
578- return getbufvar (self .number ,' rails_file_type' )
579- endif
580- let f = s: gsub (fnamemodify (bufname (self ._number),' :p' ),' \\ @!' ,' /' )
581+ let f = s: gsub (fnamemodify (bufname (self .number ()),' :p' ),' \\ @!' ,' /' )
581582 let f = s: sub (f ,' /$' ,' ' )
582583 let sep = matchstr (f ,' ^[^\\/]\{3,\}\zs[\\/]' )
583584 if sep != " "
@@ -714,7 +715,7 @@ function! s:readable_calculate_file_type() dict abort
714715endfunction
715716
716717function ! s: buffer_type_name (... ) dict abort
717- let type = getbufvar (self ._number ,' rails_cached_file_type' )
718+ let type = getbufvar (self .number () ,' rails_cached_file_type' )
718719 if type == ' '
719720 let type = self .calculate_file_type ()
720721 endif
@@ -773,7 +774,7 @@ endfunction
773774
774775call s: add_methods (' app' ,[' default_locale' ,' environments' ,' file' ,' has' ,' test_suites' ])
775776call s: add_methods (' file' ,[' path' ,' name' ,' lines' ,' getline' ])
776- call s: add_methods (' buffer' ,[' app' ,' path' ,' name' ,' lines' ,' getline' ,' type_name' ])
777+ call s: add_methods (' buffer' ,[' app' ,' number ' , ' path' ,' name' ,' lines' ,' getline' ,' type_name' ])
777778call s: add_methods (' readable' ,[' app' ,' calculate_file_type' ,' type_name' ,' line_count' ])
778779
779780" }}}1
0 commit comments