Herbert Breunung avatar Herbert Breunung committed 6547d71

sanitize Kephra:doc API fir file assignement

Comments (0)

Files changed (2)

lib/Kephra/App/Panel/Editor.pm

         my $ed = Kephra::App::Editor->new( $main_doc_bar );
         $doc = Kephra::Document->new();
         $doc->editor( $ed );
-        $doc->load($file_path);
+        $doc->assign_file($file_path);
         Kephra::DocumentStash::add( $doc );
         $main_doc_bar->add_page( $doc->file_name, -1, 1, $ed) ;
     }

lib/Kephra/Document.pm

     is  => 'rw',
     isa => sub {die "$_[0] is no editor" unless ref $_[0] eq 'Kephra::App::Editor'},
 );
-has file_path    => ( is  => 'rw', );
-has file_dir     => ( is  => 'rw', );
-has file_name    => ( is  => 'rw', );
+has file_path    => ( is  => 'ro', );
+has file_dir     => ( is  => 'ro', );
+has file_name    => ( is  => 'ro', );
 #has content      => ( is  => 'rw' );
 has notes        => ( is  => 'rw', );
 
 has folded_lines => ( is  => 'rw', );
 has marked_lines => ( is  => 'rw', );
 
-sub load {
+sub assign_file {
     my ($self, $file_path) = @_;
     return unless $file_path;
     $file_path = Kephra::File::_normalize_name($file_path);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.