public static bool IsConstantDefined(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ constantName) { RubyUtils.CheckConstantName(constantName); object constant; return(self.TryResolveConstantNoAutoload(constantName, out constant)); }
public static bool IsConstantDefined(RubyModule /*!*/ self, [DefaultProtocol, NotNull] string /*!*/ constantName) { RubyUtils.CheckConstantName(constantName); object constant; // MRI checks declared constans only and don't trigger autoload: return(self.TryGetConstant(null, constantName, out constant)); }
public static void SetAutoloadedConstant(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ constantName, [DefaultProtocol, NotNull] MutableString /*!*/ path) { RubyUtils.CheckConstantName(constantName); if (path.IsEmpty) { throw RubyExceptions.CreateArgumentError("empty file name"); } self.SetAutoloadedConstant(constantName, path); }
public static object RemoveConstant(RubyModule /*!*/ self, [DefaultProtocol, NotNull] string /*!*/ constantName) { object value; if (!self.TryRemoveConstant(constantName, out value)) { RubyUtils.CheckConstantName(constantName); throw RubyExceptions.CreateNameError("constant {0}::{1} not defined", self.Name, constantName); } return(value); }
public static object RemoveConstant(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ constantName) { object value; if (!self.TryGetConstantNoAutoload(constantName, out value)) { RubyUtils.CheckConstantName(constantName); throw RubyExceptions.CreateNameError(String.Format("constant {0}::{1} not defined", self.Name, constantName)); } self.RemoveConstant(constantName); return(value); }
public static object NewStruct(BlockParam block, RubyClass /*!*/ self, [DefaultProtocol] MutableString className, [DefaultProtocol, NotNullItems] params string /*!*/[] /*!*/ attributeNames) { if (className == null) { return(Create(block, self, null, attributeNames)); } string strName = className.ConvertToString(); RubyUtils.CheckConstantName(strName); return(Create(block, self, strName, attributeNames)); }
public static object NewStruct(BlockParam block, RubyClass /*!*/ self, [DefaultProtocol, Optional] MutableString className, [NotNull] params object[] /*!*/ attributeNames) { string[] symbols = Protocols.CastToSymbols(self.Context, attributeNames); if (className == null) { return(Create(block, self, null, symbols)); } string strName = className.ConvertToString(); RubyUtils.CheckConstantName(strName); return(Create(block, self, strName, symbols)); }
public static object SetConstantValue(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ constantName, object value) { RubyUtils.CheckConstantName(constantName); RubyUtils.SetConstant(self, constantName, value); return(value); }