Пример #1
0
            public static object Open(BlockParam block, RubyClass /*!*/ self, [DefaultProtocol, NotNull] MutableString /*!*/ path)
            {
                var strPath    = self.Context.DecodePath(path);
                var file       = new RubyFile(self.Context, strPath, IOMode.ReadOnly);
                var gzipReader = Create(self, file);

                return(gzipReader.Do(block));
            }
Пример #2
0
 public static object ParseFile(RubyModule /*!*/ self, [DefaultProtocol, NotNull] MutableString /*!*/ path)
 {
     using (Stream stream = new RubyFile(self.Context, path.ConvertToString(), IOMode.Default).GetReadableStream()) {
         foreach (Node obj in MakeComposer(self.Context, stream))
         {
             return(obj);
         }
     }
     return(ScriptingRuntimeHelpers.False);
 }
Пример #3
0
 public static object LoadFile(RubyScope /*!*/ scope, RubyModule /*!*/ self, [DefaultProtocol, NotNull] MutableString /*!*/ path)
 {
     using (RubyFile file = new RubyFile(self.Context, path.ConvertToString(), IOMode.Default)) {
         foreach (object obj in MakeConstructor(scope.GlobalScope, file.GetReadableStream()))
         {
             return(obj);
         }
     }
     return(null);
 }
Пример #4
0
            public static object Open(BlockParam block, RubyClass /*!*/ self,
                                      [DefaultProtocol, NotNull] MutableString /*!*/ path,
                                      [DefaultParameterValue(0)] int level,
                                      [DefaultParameterValue(DEFAULT_STRATEGY)] int strategy)
            {
                var strPath    = self.Context.DecodePath(path);
                var file       = new RubyFile(self.Context, strPath, IOMode.WriteOnly | IOMode.Truncate | IOMode.CreateIfNotExists);
                var gzipWriter = Create(self, file, level, strategy);

                return(gzipWriter.Do(block));
            }