public RubySymbol /*!*/ GetSymbol(RubyContext /*!*/ context) { return(_symbol ?? (_symbol = context.EncodeIdentifier(_string))); }
public static MutableString /*!*/ ToString(RubySymbol /*!*/ self) { return(self.String.Clone()); }
public static RubyEncoding GetCompatible(RubyClass /*!*/ self, [NotNull] RubyEncoding /*!*/ encoding, [NotNull] RubySymbol /*!*/ symbol) { return(GetCompatible(self, encoding, symbol.String)); }
public static object Match(BinaryOpStorageWithScope /*!*/ storage, RubyScope /*!*/ scope, RubySymbol /*!*/ self, [DefaultProtocol, NotNull] MutableString /*!*/ pattern) { return(MutableStringOps.Match(storage, scope, self.String.Clone(), pattern)); }
public static RubyEncoding /*!*/ GetEncoding(RubySymbol /*!*/ self) { return(self.Encoding); }
public static bool Equals(RubySymbol /*!*/ self, object other) { return(false); }
public static object Match(BinaryOpStorageWithScope /*!*/ storage, RubyScope /*!*/ scope, RubySymbol /*!*/ self, object obj) { return(MutableStringOps.Match(storage, scope, self.String.Clone(), obj)); }
internal bool HasKey(RubySymbol /*!*/ key) { lock (_threadLocalStorage) { return(_threadLocalStorage.ContainsKey(key)); } }
public static object GetElement(Thread /*!*/ self, [NotNull] RubySymbol /*!*/ key) { RubyThreadInfo info = RubyThreadInfo.FromThread(self); return(info[key]); }
public static int ToInteger(RubySymbol /*!*/ self) { return(self.Id); }
public static object Match(RubyScope /*!*/ scope, RubySymbol /*!*/ self, [NotNull] RubyRegex /*!*/ regex) { return(MutableStringOps.Match(scope, self.ToMutableString(), regex)); }
public static object NewAnonymousStruct(BlockParam block, RubyClass /*!*/ self, [NotNull] RubySymbol /*!*/ firstAttibuteName, [DefaultProtocol, NotNullItems] params string /*!*/[] /*!*/ attributeNames) { return(CreateAnonymousWithFirstAttribute(block, self, RubyOps.ConvertSymbolToClrString(firstAttibuteName), attributeNames)); }
public static object SetValue(RubyStruct /*!*/ self, [NotNull] RubySymbol /*!*/ name, object value) { return(self[name.ToString()] = value); }
public static object MethodMissing(RubyScope /*!*/ scope, BlockParam block, string /*!*/ self, [NotNull] RubySymbol /*!*/ name, params object[] /*!*/ args) { if (name.EndsWith('=') || name.EndsWith('!')) { throw RubyExceptions.CreateTypeError("Mutating method `{0}' called for an immutable string (System::String)", name); } // TODO: forward to MutableString until we implement the methods here: return(KernelOps.SendMessageOpt(scope, block, ToStr(self), name.ToString(), args)); }
public static bool Equals(RubySymbol /*!*/ lhs, [NotNull] RubySymbol /*!*/ rhs) { return(lhs.Equals(rhs)); }
public static object HasKey(Thread /*!*/ self, [NotNull] RubySymbol /*!*/ key) { RubyThreadInfo info = RubyThreadInfo.FromThread(self); return(info.HasKey(key)); }
public static bool Equals(RubyContext /*!*/ context, RubySymbol /*!*/ lhs, [NotNull] ClrName /*!*/ rhs) { return(ClrNameOps.IsEqual(context, rhs, lhs)); }
public static RubySymbol /*!*/ ToSymbol(RubySymbol /*!*/ self) { return(self); }
public static object Match(ClrName /*!*/ self, [NotNull] RubySymbol /*!*/ str) { throw RubyExceptions.CreateTypeError("type mismatch: Symbol given"); }
public static string /*!*/ ToClrString(RubySymbol /*!*/ self) { return(self.ToString()); }
public static object Match(BinaryOpStorageWithScope /*!*/ storage, RubyScope /*!*/ scope, RubySymbol /*!*/ self, [NotNull] RubyRegex /*!*/ regex) { return(MutableStringOps.Match(storage, scope, self.String.Clone(), regex)); }
public static Proc /*!*/ ToProc(RubyScope /*!*/ scope, RubySymbol /*!*/ self) { return(Proc.CreateMethodInvoker(scope, self.ToString())); }
public static bool IsEmpty(RubySymbol /*!*/ self) { return(self.IsEmpty); }
public static int Compare(RubySymbol /*!*/ self, [NotNull] RubySymbol /*!*/ other) { return(Math.Sign(self.CompareTo(other))); }
public static int GetLength(RubySymbol /*!*/ self) { return((self.Encoding.IsKCoding) ? self.GetByteCount() : self.GetCharCount()); }
public static int Compare(RubyContext /*!*/ context, RubySymbol /*!*/ self, [NotNull] ClrName /*!*/ other) { return(-ClrNameOps.Compare(context, other, self)); }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, RubySymbol /*!*/ self) { var str = self.ToString(); bool allowMultiByteCharacters = context.RubyOptions.Compatibility >= RubyCompatibility.Ruby19 || context.KCode != null; var result = self.String.Clone(); // simple cases: if ( Tokenizer.IsMethodName(str, allowMultiByteCharacters) || Tokenizer.IsConstantName(str, allowMultiByteCharacters) || Tokenizer.IsInstanceVariableName(str, allowMultiByteCharacters) || Tokenizer.IsClassVariableName(str, allowMultiByteCharacters) || Tokenizer.IsGlobalVariableName(str, allowMultiByteCharacters) ) { result.Insert(0, ':'); } else { // TODO: this is neither efficient nor complete. // Any string that parses as 'sym' should not be quoted. switch (str) { case null: // Ruby doesn't allow empty symbols, we can get one from outside though: return(MutableString.CreateAscii(":\"\"")); case "!": case "|": case "^": case "&": case "<=>": case "==": case "===": case "=~": case "!=": case "!~": case ">": case ">=": case "<": case "<=": case "<<": case ">>": case "+": case "-": case "*": case "/": case "%": case "**": case "~": case "+@": case "-@": case "[]": case "[]=": case "`": case "$!": case "$@": case "$,": case "$;": case "$/": case "$\\": case "$*": case "$$": case "$?": case "$=": case "$:": case "$\"": case "$<": case "$>": case "$.": case "$~": case "$&": case "$`": case "$'": case "$+": result.Insert(0, ':'); break; default: result.Insert(0, ":\"").Append('"'); break; } } if (context.RuntimeId != self.RuntimeId) { result.Append(" @").Append(self.RuntimeId.ToString(CultureInfo.InvariantCulture)); } return(result); }
public static object Compare(RubySymbol /*!*/ self, object other) { return(null); }
public static RubyEncoding GetCompatible(RubyClass /*!*/ self, [NotNull] RubySymbol /*!*/ symbol, [NotNull] MutableString /*!*/ str) { return(GetCompatible(self, symbol.String, str)); }
public Symbol(string str, RubySymbol sym) { _string = str; _symbol = sym; }