private Map ( object obj, IDictionary map ) : |
||
obj | object | |
map | IDictionary | |
return |
public static object ToYamlProperties(object self, [NotNull] RubyRepresenter /*!*/ rep) { var map = new Dictionary <object, object>(); rep.AddYamlProperties(map, self, true); return(rep.Map(self, map)); }
public static object ToYamlProperties(object self, [NotNull] RubyRepresenter /*!*/ rep) { Hash map = new Hash(rep.Context); RubyRepresenter.AddYamlProperties(rep.Context, self, map); return(rep.Map(self, map)); }
public static Node ToYamlNode(Exception /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { Hash map = new Hash(rep.Context); map.Add(MutableString.Create("message"), _Message.Target(_Message, rep.Context, self)); RubyRepresenter.AddYamlProperties(rep.Context, self, map); return(rep.Map(self, map)); }
public static Node ToYaml(object self, [NotNull] RubyRepresenter /*!*/ rep) { Hash map = new Hash(rep.Context); map.Add(MutableString.Create("begin"), _Begin.Target(_Begin, rep.Context, self)); map.Add(MutableString.Create("end"), _End.Target(_End, rep.Context, self)); map.Add(MutableString.Create("excl"), _ExcludeEnd.Target(_ExcludeEnd, rep.Context, self)); RubyRepresenter.AddYamlProperties(rep.Context, self, map); return(rep.Map(self, map)); }
public static Node ToYamlNode(UnaryOpStorage /*!*/ messageStorage, Exception /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { var site = messageStorage.GetCallSite("message", 0); var map = new Dictionary <object, object>(); rep.AddYamlProperties(map, self, false); return(rep.Map( new Dictionary <Node, Node> { { rep.Scalar(null, "message", ScalarQuotingStyle.None), rep.RepresentItem(site.Target(site, self)) } }, rep.GetTagUri(self), map, FlowStyle.Block )); }
public static Node /*!*/ ToYamlNode(RubyStruct /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { var fieldNames = self.GetNames(); var fields = new Dictionary <Node, Node>(fieldNames.Count); for (int i = 0; i < fieldNames.Count; i++) { fields[rep.Scalar(null, fieldNames[i], ScalarQuotingStyle.None)] = rep.RepresentItem(self.Values[i]); } var map = new Dictionary <object, object>(); rep.AddYamlProperties(map, self, false); return(rep.Map(fields, rep.GetTagUri(self), map, FlowStyle.Block)); }
public static Node /*!*/ ToYaml(UnaryOpStorage /*!*/ beginStorage, UnaryOpStorage /*!*/ endStorage, UnaryOpStorage /*!*/ exclStorage, Range /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { var begin = beginStorage.GetCallSite("begin"); var end = endStorage.GetCallSite("end"); var map = new Dictionary <object, object>(); rep.AddYamlProperties(map, self, false); return(rep.Map( new Dictionary <Node, Node> { { rep.Scalar(null, "begin", ScalarQuotingStyle.None), rep.RepresentItem(begin.Target(begin, self)) }, { rep.Scalar(null, "end", ScalarQuotingStyle.None), rep.RepresentItem(end.Target(end, self)) }, { rep.Scalar(null, "excl", ScalarQuotingStyle.None), rep.Scalar(self.ExcludeEnd) }, }, rep.GetTagUri(self), map, FlowStyle.Block )); }
public static Node ToYamlNode(RubyStruct /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { RubyContext context = self.Class.Context; RubyArray members = _Members.Target(_Members, context, self); RubyArray values = _Values.Target(_Values, context, self); if (members.Count != values.Count) { throw new ArgumentException("Struct values and members returned arrays of different lengths"); } Hash map = new Hash(self.Class.Context); for (int i = 0; i < members.Count; i++) { IDictionaryOps.SetElement(context, map, members[i], values[i]); } RubyRepresenter.AddYamlProperties(context, self, map); return(rep.Map(self, map)); }
public static Node /*!*/ ToYamlNode(MutableString /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { if (!self.IsEmpty && ContainsBinaryData(self)) { return(rep.BaseCreateNode(self.ToByteArray())); } Debug.Assert(self.IsAscii()); string str = self.ToString(); ScalarQuotingStyle style = ScalarQuotingStyle.None; if (str.StartsWith(":", StringComparison.Ordinal)) { style = ScalarQuotingStyle.Double; } else { style = rep.GetYamlStyle(self); } var tag = rep.GetTagUri(self, Tags.Str, typeof(MutableString)); IList instanceVariableNames = rep.ToYamlProperties(self); if (instanceVariableNames.Count == 0) { return(rep.Scalar(tag, str, style)); } var map = new Dictionary <object, object>(); rep.AddYamlProperties(map, self, instanceVariableNames, false); return(rep.Map( new Dictionary <Node, Node> { { rep.Scalar(null, "str", style), rep.Scalar(null, str, style) } }, tag, map, FlowStyle.Block )); }
public static Node ToYamlNode(MutableString /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { if (RubyOps.IsTrue(_IsBinaryData.Target(_IsBinaryData, rep.Context, self))) { return(rep.BaseCreateNode(self.ConvertToBytes())); } string str = self.ConvertToString(); RubyArray props = RubyRepresenter.ToYamlProperties(rep.Context, self); if (props.Count == 0) { MutableString taguri = RubyRepresenter.TagUri(rep.Context, self); char style = (char)0; if (str.StartsWith(":")) { style = '"'; } else { MutableString styleStr = RubyRepresenter.ToYamlStyle(rep.Context, self) as MutableString; if (styleStr != null && styleStr.Length > 0) { style = styleStr.GetChar(0); } } return(rep.Scalar(taguri != null ? taguri.ConvertToString() : "", str, style)); } Hash map = new Hash(rep.Context); map.Add(MutableString.Create("str"), str); RubyRepresenter.AddYamlProperties(rep.Context, self, map, props); return(rep.Map(self, map)); }
public static Node ToYamlNode(Hash /*!*/ self, [NotNull] RubyRepresenter /*!*/ rep) { return(rep.Map(self, self)); }
public static Node/*!*/ Map(RubyContext/*!*/ context, [NotNull]BlockParam/*!*/ block, RubyRepresenter/*!*/ self, [DefaultProtocol]MutableString taguri, object to_yaml_style) { var map = new Dictionary<object, object>(); object blockResult; block.Yield(map, out blockResult); return self.Map(taguri, to_yaml_style ?? false, map); }