public static MutableString/*!*/ BaseToMutableString(IRubyObject/*!*/ self) { if (self is RubyObject) { return ToMutableString(self); } else { return MutableString.CreateMutable(self.BaseToString()); } }
private static RubyClass /*!*/ GetImmediateClass(object self) { IRubyObject rubyObj = self as IRubyObject; ContractUtils.RequiresNotNull(rubyObj, "self"); return(rubyObj.ImmediateClass); }
private void CopyInstanceDataFrom(IRubyObject/*!*/ source, bool copyFrozenState) { // copy instance data, but not the state: var sourceData = source.TryGetInstanceData(); if (sourceData != null) { _instanceData = new RubyInstanceData(); sourceData.CopyInstanceVariablesTo(_instanceData); } // copy flags: SetTaint(this, IsTainted(source)); if (copyFrozenState && IsFrozen(source)) { Freeze(this); } }
public object Invoke <TScope>(CallSite /*!*/ callSite, TScope /*!*/ scope, object self) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { // TODO: optimize RubyInstanceData data = obj.TryGetInstanceData(); return((data != null) ? data.GetInstanceVariable(Name) : null); } else { return(((CallSite <Func <CallSite, TScope, object, object> >)callSite).Update(callSite, scope, self)); } }
public object Invoke <TScope>(CallSite /*!*/ callSite, TScope /*!*/ scope, object self, T0 arg0) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { var result = (object)arg0; // TODO: optimize obj.ImmediateClass.Context.SetInstanceVariable(obj, Name, result); return(result); } else { return(((CallSite <Func <CallSite, TScope, object, T0, object> >)callSite).Update(callSite, scope, self, arg0)); } }
private void CopyInstanceDataFrom(IRubyObject /*!*/ source, bool copyFrozenState) { // copy instance data, but not the state: var sourceData = source.TryGetInstanceData(); if (sourceData != null) { _instanceData = new RubyInstanceData(); sourceData.CopyInstanceVariablesTo(_instanceData); } // copy flags: SetTaint(this, IsTainted(source)); if (copyFrozenState && IsFrozen(source)) { Freeze(this); } }
public static bool IsFrozen(IRubyObject/*!*/ obj) { var instanceData = obj.TryGetInstanceData(); return instanceData != null && instanceData.Frozen; }
public Meta(Expression /*!*/ expression, Restrictions /*!*/ restrictions, IRubyObject /*!*/ value) : base(expression, restrictions, value) { ContractUtils.RequiresNotNull(value, "value"); }
public RubyObjectDebugView(IRubyObject /*!*/ obj) { Assert.NotNull(obj); _obj = obj; }
public RubyObjectDebugView(IRubyObject/*!*/ obj) { Assert.NotNull(obj); _obj = obj; }
public Meta(Expression/*!*/ expression, BindingRestrictions/*!*/ restrictions, IRubyObject/*!*/ value) : base(expression, restrictions, value) { ContractUtils.RequiresNotNull(value, "value"); }
public static void SetTaint(IRubyObject/*!*/ obj, bool value) { obj.GetInstanceData().Tainted = value; }
public static MetaObject/*!*/ GetMetaObject(IRubyObject/*!*/ obj, Expression/*!*/ parameter) { return new RubyObject.Meta(parameter, Restrictions.Empty, obj); }
public static DynamicMetaObject/*!*/ GetMetaObject(IRubyObject/*!*/ obj, MSA.Expression/*!*/ parameter) { return new RubyObject.Meta(parameter, BindingRestrictions.Empty, obj); }
public static void Freeze(IRubyObject /*!*/ obj) { obj.GetInstanceData().Freeze(); }
public static bool IsTainted(IRubyObject /*!*/ obj) { var instanceData = obj.TryGetInstanceData(); return(instanceData != null && instanceData.Tainted); }
public static MutableString/*!*/ ToMutableString(IRubyObject/*!*/ self) { return RubyUtils.FormatObject(self.ImmediateClass.GetNonSingletonClass().Name, self.GetInstanceData().ObjectId, self.IsTainted); }
public static bool ValueEquals(IRubyObject self, object other) { return object.ReferenceEquals(self, other); }
public static int Hash(IRubyObject self) { return self == null ? RubyUtils.NilObjectId : RuntimeHelpers.GetHashCode(self); }
public static bool IsTainted(IRubyObject/*!*/ obj) { var instanceData = obj.TryGetInstanceData(); return instanceData != null && instanceData.Tainted; }
public static RubyContext/*!*/ GetContextFromIRubyObject(IRubyObject/*!*/ obj) { return obj.ImmediateClass.Context; }
public static void Freeze(IRubyObject/*!*/ obj) { obj.GetInstanceData().Freeze(); }
public static bool IsFrozen(IRubyObject /*!*/ obj) { var instanceData = obj.TryGetInstanceData(); return(instanceData != null && instanceData.Frozen); }
public static bool ValueEquals([NotNull] IRubyObject /*!*/ self, object other) { return(self.BaseEquals(other)); }
public static void SetTaint(IRubyObject /*!*/ obj, bool value) { obj.GetInstanceData().Tainted = value; }