public static object YamlAs(RubyScope /*!*/ scope, RubyModule /*!*/ self, object tag) { RubyModule yamlModule; scope.RubyContext.TryGetModule(scope.GlobalScope, "YAML", out yamlModule); return(RubyYaml.TagClass(yamlModule, tag, self)); }
private static object ParseObject(RubyConstructor /*!*/ ctor, string /*!*/ value) { Composer composer = RubyYaml.MakeComposer(new StringReader(value), ctor.Encoding); if (composer.CheckNode()) { return(ctor.ConstructObject(composer.GetNode())); } else { throw new ConstructorException("Invalid YAML element: " + value); } }
public static object ToYaml(object self, [NotNull] RubyRepresenter /*!*/ emitter) { if (emitter.Level > 0) { // return a node: return(emitter.Represent(self)); } else { // return a string: return(RubyYaml.DumpAll(emitter, new object[] { self }, null)); } }
public static object CreateSequence([NotNull] BlockParam /*!*/ block, Out /*!*/ self, [DefaultProtocol] MutableString taguri, object yamlStyle) { var rep = self._representer; var seq = new SequenceNode(rep.ToTag(taguri), new List <Node>(), RubyYaml.ToYamlFlowStyle(yamlStyle)); object blockResult; if (block.Yield(seq, out blockResult)) { return(blockResult); } return(seq); }
public static MutableString /*!*/ TagUri(RubyContext /*!*/ context, RubyTime /*!*/ self) { return(RubyYaml.GetTagUri(context, self, Tags.Timestamp, typeof(RubyTime))); }
public static MutableString /*!*/ TagUri(RubyContext /*!*/ context, RubyRegex /*!*/ self) { return(RubyYaml.GetTagUri(context, self, Tags.RubyRegexp, typeof(RubyRegex))); }
public static MutableString /*!*/ TagUri(RubyContext /*!*/ context, MutableString /*!*/ self) { return(RubyYaml.GetTagUri(context, self, Tags.Str, typeof(MutableString))); }
public static MutableString TagUri(RubyContext /*!*/ context, object self) { return(RubyYaml.GetTagUri(context, self, Tags.RubyException, typeof(Exception))); }
public static MutableString /*!*/ TagUri(RubyContext /*!*/ context, RubyArray /*!*/ self) { return(RubyYaml.GetTagUri(context, self, Tags.Seq, typeof(RubyArray))); }
public static object Transform(RubyScope /*!*/ scope, Node /*!*/ self) { return(new RubyConstructor(scope.GlobalScope, new SimpleNodeProvider(self, RubyYaml.GetEncoding(scope.RubyContext))).GetData()); }
internal ScalarQuotingStyle GetYamlStyle(object obj) { var site = _siteStorage.ToYamlStyle; return(RubyYaml.ToYamlStyle(Context, site.Target(site, obj))); }
public static object Emit(YamlCallSiteStorage /*!*/ siteStorage, YamlStream /*!*/ self, [Optional] RubyIO io) { return(RubyYaml.DumpAll(siteStorage, self._documents, io)); }
public static object CreateMap([NotNull] BlockParam /*!*/ block, Out /*!*/ self, [DefaultProtocol] MutableString taguri, object yamlStyle) { var rep = self._representer; var map = new MappingNode(rep.ToTag(taguri), new Dictionary <Node, Node>(), RubyYaml.ToYamlFlowStyle(yamlStyle)); object blockResult; if (block.Yield(map, out blockResult)) { return(blockResult); } return(map); }
public static object SetStyle(RubyContext /*!*/ context, ScalarNode /*!*/ self, object value) { self.Style = RubyYaml.ToYamlStyle(context, value); return(value); }
public static object SetStyle(SequenceNode /*!*/ self, object value) { self.FlowStyle = RubyYaml.ToYamlFlowStyle(value); return(value); }
public static object ToYaml(YamlCallSiteStorage /*!*/ siteStorage, object self, [DefaultParameterValue(null)] object options) { return(RubyYaml.DumpAll(siteStorage, new object[] { self }, null)); }
public static MutableString /*!*/ TagUri(RubyContext /*!*/ context, object /*!*/ self) { return(RubyYaml.GetTagUri(context, self, Tags.Map, typeof(Hash))); }
public static object ToYaml(RubyContext /*!*/ context, object self, params object[] args) { return(RubyYaml.DumpAll(context, new object[] { self }, null)); }
public static object Emit(RubyContext /*!*/ context, YamlStream /*!*/ self, [Optional] RubyIO io) { return(RubyYaml.DumpAll(context, self.Documents, io)); }