本文整理汇总了C#中IronRuby.Builtins.RubyClass类的典型用法代码示例。如果您正苦于以下问题:C# RubyClass类的具体用法?C# RubyClass怎么用?C# RubyClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RubyClass类属于IronRuby.Builtins命名空间,在下文中一共展示了RubyClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefineGlobalClass
protected RubyClass/*!*/ DefineGlobalClass(string/*!*/ name, Type/*!*/ type, RubyClass/*!*/ super,
Action<RubyModule> instanceTrait, Action<RubyModule> classTrait, RubyModule[]/*!*/ mixins, Delegate[] factories) {
RubyClass result = _context.DefineLibraryClass(name, type, instanceTrait, classTrait, super, mixins, factories, _builtin);
_context.ObjectClass.SetConstant(result.Name, result);
return result;
}
示例2: Subclass
public Subclass(RubyClass/*!*/ rubyClass, MutableString begin, MutableString end, bool excludeEnd)
: base(begin, end, excludeEnd)
{
Assert.NotNull(rubyClass);
Debug.Assert(!rubyClass.IsSingletonClass);
ImmediateClass = rubyClass;
}
示例3: Subclass
// called by Proc#new rule when creating a Ruby subclass of Proc:
public Subclass(RubyClass/*!*/ rubyClass, Proc/*!*/ proc)
: base(proc)
{
Assert.NotNull(rubyClass);
Debug.Assert(!rubyClass.IsSingletonClass);
ImmediateClass = rubyClass;
}
示例4: Convert
public static MutableString/*!*/ Convert(RubyClass/*!*/ self,
[DefaultProtocol]MutableString/*!*/ toEncoding, [DefaultProtocol]MutableString/*!*/ fromEncoding,
[DefaultProtocol]MutableString/*!*/ str) {
//return iconv(to, from, str).join;
return null;
}
示例5: CreateHash
public static Hash CreateHash(BlockParam block, RubyClass/*!*/ self, object defaultValue)
{
if (block != null) {
throw RubyExceptions.CreateArgumentError("wrong number of arguments");
}
return new Hash(self.Context.EqualityComparer, null, defaultValue);
}
示例6: Create
public static char Create(RubyClass/*!*/ self, [DefaultProtocol]MutableString/*!*/ str) {
if (str.IsEmpty) {
throw EmptyError("string");
}
return str.GetChar(0);
}
示例7: Subclass
// called by Class#new rule when creating a Ruby subclass of IO:
public Subclass(RubyClass/*!*/ rubyClass)
: base(rubyClass.Context)
{
Assert.NotNull(rubyClass);
Debug.Assert(!rubyClass.IsSingletonClass);
ImmediateClass = rubyClass;
}
示例8: InducedFrom
public static int InducedFrom(RubyClass/*!*/ self, double value)
{
if (value >= Int32.MinValue && value <= Int32.MaxValue) {
return (Int32)value;
}
throw RubyExceptions.CreateRangeError("Float {0} out of range of {1}", value, self.Name);
}
示例9: RubyStruct
// copy ctor:
private RubyStruct(RubyClass/*!*/ rubyClass, object[]/*!*/ data)
: base(rubyClass)
{
Debug.Assert(rubyClass.StructInfo != null);
Debug.Assert(!rubyClass.IsSingletonClass);
_data = ArrayUtils.Copy(data);
}
示例10: CreateFile
public static RubyFile/*!*/ CreateFile(RubyClass/*!*/ self, MutableString/*!*/ path, int mode) {
if (path.IsEmpty) {
throw new Errno.InvalidError();
}
return new RubyFile(self.Context, path.ConvertToString(), (RubyFileMode)mode);
}
示例11: DefineGlobalClass
protected RubyClass/*!*/ DefineGlobalClass(string/*!*/ name, Type/*!*/ type, bool isSelfContained, RubyClass/*!*/ super,
Action<RubyModule> instanceTrait, Action<RubyModule> classTrait, Action<RubyModule> constantsInitializer,
RubyModule/*!*/[]/*!*/ mixins, params Delegate[] factories) {
RubyClass result = _context.DefineLibraryClass(name, type, instanceTrait, classTrait, constantsInitializer, super, mixins, factories, isSelfContained, _builtin);
_context.ObjectClass.SetConstant(result.Name, result);
return result;
}
示例12: CreateTCPSocket
public static TCPSocket/*!*/ CreateTCPSocket(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ remoteHost, object remotePort) {
int port = ConvertToPortNum(self.Context, remotePort);
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(remoteHost.ConvertToString(), port);
return new TCPSocket(self.Context, socket);
}
示例13: CreateSubclass
public static Hash/*!*/ CreateSubclass(RubyClass/*!*/ self, params object[]/*!*/ items) {
Debug.Assert(items.Length > 0);
if (items.Length % 2 != 0) {
throw RubyExceptions.CreateArgumentError("odd number of arguments for Hash");
}
return RubyUtils.SetHashElements(self.Context, Hash.CreateInstance(self), items);
}
示例14: Create
public static RhoDatabase/*!*/ Create(RubyClass/*!*/ self, [NotNull]MutableString/*!*/ dbName, [NotNull]MutableString/*!*/ dbPartition)
{
RhoDatabase rbDB = new RhoDatabase();
rbDB.m_db = new DBAdapter();
rbDB.m_db.rb_open(dbName.ToString(), dbPartition.ToString());
return rbDB;
}
示例15: DefineGlobalClass
protected RubyClass/*!*/ DefineGlobalClass(string/*!*/ name, Type/*!*/ type, int restrictions, RubyClass/*!*/ super,
Action<RubyModule> instanceTrait, Action<RubyModule> classTrait, Action<RubyModule> constantsInitializer,
RubyModule/*!*/[]/*!*/ mixins, params Delegate[] factories) {
RubyClass result = _context.DefineLibraryClass(name, type, instanceTrait, classTrait, constantsInitializer, super, mixins, factories, (ModuleRestrictions)restrictions, _builtin);
PublishModule(name, result);
return result;
}