Exemple #1
0
        public static bool InstanceVariableDefined(RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]string/*!*/ name) {
            object value;
            if (!context.TryGetInstanceVariable(self, name, out value)) {
                // We didn't find it, check if the name is valid
                context.CheckInstanceVariableName(name);
                return false;
            }

            return true;
        }
Exemple #2
0
        public static object RemoveInstanceVariable(RubyContext/*!*/ context, object/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ name) {
            object value;
            if (!context.TryRemoveInstanceVariable(self, name, out value)) {
                // We didn't find it, check if the name is valid
                context.CheckInstanceVariableName(name);

                throw RubyExceptions.CreateNameError(String.Format("instance variable `{0}' not defined", name));
            }

            return value;
        }
Exemple #3
0
 public static object InstanceVariableSet(RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]string/*!*/ name, object value) {
     context.CheckInstanceVariableName(name);
     context.SetInstanceVariable(self, name, value);
     return value;
 }