本文整理汇总了C#中IronRuby.Builtins.RubyEncoding类的典型用法代码示例。如果您正苦于以下问题:C# RubyEncoding类的具体用法?C# RubyEncoding怎么用?C# RubyEncoding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RubyEncoding类属于IronRuby.Builtins命名空间,在下文中一共展示了RubyEncoding类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetAllNames
public static RubyArray GetAllNames(RubyContext/*!*/ context, RubyEncoding/*!*/ self)
{
var result = new RubyArray();
string name = self.Name;
result.Add(MutableString.Create(name));
foreach (var alias in RubyEncoding.Aliases) {
if (StringComparer.OrdinalIgnoreCase.Equals(alias.Value, name)) {
result.Add(MutableString.CreateAscii(alias.Key));
}
}
if (self == context.RubyOptions.LocaleEncoding) {
result.Add(MutableString.CreateAscii("locale"));
}
if (self == context.DefaultExternalEncoding) {
result.Add(MutableString.CreateAscii("external"));
}
if (self == context.GetPathEncoding()) {
result.Add(MutableString.CreateAscii("filesystem"));
}
return result;
}
开发者ID:TerabyteX,项目名称:main,代码行数:27,代码来源:RubyEncodingOps.cs
示例2: CreateKCoding
private static RubyEncoding/*!*/ CreateKCoding(int codepage, RubyEncoding/*!*/ realEncoding) {
#if SILVERLIGHT
return new RubyEncoding(new UTF8Encoding(false, false), new UTF8Encoding(false, true), realEncoding);
#else
return new RubyEncoding(KCoding.Create(codepage, false), KCoding.Create(codepage, true), realEncoding);
#endif
}
开发者ID:aceptra,项目名称:ironruby,代码行数:7,代码来源:RubyEncoding.cs
示例3: RubyMethodBody
internal RubyMethodBody(MethodDeclaration/*!*/ ast, MSA.SymbolDocumentInfo document, RubyEncoding/*!*/ encoding) {
Assert.NotNull(ast, encoding);
_ast = ast;
_document = document;
_encoding = encoding;
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:7,代码来源:RubyMethodBody.cs
示例4: GetMutableString
public MutableString/*!*/ GetMutableString(RubyEncoding/*!*/ encoding) {
string str = _value as string;
if (str != null) {
return MutableString.Create(str, encoding);
} else {
return MutableString.CreateBinary((byte[])_value, encoding);
}
}
开发者ID:atczyc,项目名称:ironruby,代码行数:8,代码来源:StringLiteral.cs
示例5: StringLiteral
internal StringLiteral(object/*!*/ value, RubyEncoding/*!*/ encoding, SourceSpan location)
: base(location)
{
Debug.Assert(value is string || value is byte[]);
Debug.Assert(encoding != null);
_value = value;
_encoding = encoding;
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:StringLiteral.cs
示例6: Inspect
public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, RubyEncoding/*!*/ self) {
// TODO: to_s overridden
MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding());
result.Append("#<");
result.Append(context.GetClassDisplayName(self));
result.Append(':');
result.Append(self.Name);
result.Append('>');
return result;
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:10,代码来源:RubyEncodingOps.cs
示例7: Inspect
public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, RubyEncoding/*!*/ self) {
// TODO: to_s overridden
MutableString result = MutableString.CreateMutable();
result.Append("#<");
result.Append(RubyUtils.GetClassName(context, self));
result.Append(':');
result.Append(self.Name);
result.Append(">");
return result;
}
开发者ID:tnachen,项目名称:ironruby,代码行数:10,代码来源:RubyEncodingOps.cs
示例8: RubyIO
public RubyIO(RubyContext/*!*/ context) {
ContractUtils.RequiresNotNull(context, "context");
_context = context;
_fileDescriptor = -1;
_stream = null;
// TODO (encoding): enable setting
_externalEncoding = RubyEncoding.Binary;
_internalEncoding = null;
}
开发者ID:techarch,项目名称:ironruby,代码行数:11,代码来源:RubyIO.cs
示例9: RubyConstructor
public RubyConstructor(RubyGlobalScope/*!*/ scope, NodeProvider/*!*/ nodeProvider)
: base(nodeProvider, scope) {
_encoding = RubyEncoding.GetRubyEncoding(nodeProvider.Encoding);
_newSite = CallSite<Func<CallSite, RubyModule, object, object, object, object>>.Create(
RubyCallAction.Make(scope.Context, "new", RubyCallSignature.WithImplicitSelf(3))
);
_yamlInitializeSite = CallSite<Func<CallSite, object, object, Hash, object>>.Create(
RubyCallAction.Make(scope.Context, "yaml_initialize", RubyCallSignature.WithImplicitSelf(3))
);
}
开发者ID:jschementi,项目名称:iron,代码行数:13,代码来源:RubyConstructor.cs
示例10: RubyInputProvider
internal RubyInputProvider(RubyContext/*!*/ context, ICollection<string>/*!*/ arguments, RubyEncoding/*!*/ encoding) {
Assert.NotNull(context, encoding);
Assert.NotNullItems(arguments);
_context = context;
var args = new RubyArray();
foreach (var arg in arguments) {
ExpandArgument(args, arg, encoding);
}
_commandLineArguments = args;
_lastInputLineNumber = 1;
_singleton = new object();
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:14,代码来源:RubyInputProvider.cs
示例11: AstGenerator
private MSA.Expression _sourcePathConstant; // lazy
internal AstGenerator(RubyContext/*!*/ context, RubyCompilerOptions/*!*/ options, MSA.SymbolDocumentInfo document, RubyEncoding/*!*/ encoding,
bool printInteractiveResult) {
Assert.NotNull(context, options, encoding);
_context = context;
_compilerOptions = options;
_debugCompiler = Snippets.Shared.SaveSnippets;
_debugMode = context.DomainManager.Configuration.DebugMode;
_traceEnabled = context.RubyOptions.EnableTracing;
_document = document;
_encoding = encoding;
_profiler = context.RubyOptions.Profile ? Profiler.Instance : null;
_savingToDisk = context.RubyOptions.SavePath != null;
_printInteractiveResult = printInteractiveResult;
}
开发者ID:aceptra,项目名称:ironruby,代码行数:17,代码来源:AstGenerator.cs
示例12: AstGenerator
internal AstGenerator(RubyCompilerOptions/*!*/ options, SourceUnit/*!*/ sourceUnit, RubyEncoding/*!*/ encoding,
bool debugCompiler, bool debugMode, bool traceEnabled, bool profilerEnabled, bool savingToDisk) {
Assert.NotNull(options, encoding, sourceUnit);
_context = (RubyContext)sourceUnit.LanguageContext;
_compilerOptions = options;
_debugCompiler = debugCompiler;
_debugMode = debugMode;
_traceEnabled = traceEnabled;
_sourceUnit = sourceUnit;
_document = sourceUnit.Document;
_encoding = encoding;
_profiler = profilerEnabled ? Profiler.Instance : null;
_savingToDisk = savingToDisk;
}
开发者ID:jcteague,项目名称:ironruby,代码行数:15,代码来源:AstGenerator.cs
示例13: ExpandArgument
private void ExpandArgument(RubyArray/*!*/ args, string/*!*/ arg, RubyEncoding/*!*/ encoding) {
if (arg.IndexOf('*') != -1 || arg.IndexOf('?') != -1) {
bool added = false;
foreach (string path in Glob.GlobResults(_context.DomainManager.Platform, arg, 0)) {
args.Add(MutableString.Create(path, encoding));
added = true;
}
if (!added) {
args.Add(MutableString.Create(arg, encoding));
}
} else {
args.Add(MutableString.Create(arg, encoding));
}
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:15,代码来源:RubyInputProvider.cs
示例14: RubyOptions
public RubyOptions(IDictionary<string, object>/*!*/ options)
: base(options)
{
_arguments = GetStringCollectionOption(options, "Arguments") ?? EmptyStringCollection;
_localeEncoding = GetOption(options, "LocaleEncoding", RubyEncoding.UTF8);
_defaultEncoding = GetOption<RubyEncoding>(options, "DefaultEncoding", null);
_mainFile = GetOption(options, "MainFile", (string)null);
_verbosity = GetOption(options, "Verbosity", 1);
_debugVariable = GetOption(options, "DebugVariable", false);
_enableTracing = GetOption(options, "EnableTracing", false);
_savePath = GetOption(options, "SavePath", (string)null);
_loadFromDisk = GetOption(options, "LoadFromDisk", false);
_profile = GetOption(options, "Profile", false);
_noAssemblyResolveHook = GetOption(options, "NoAssemblyResolveHook", false);
_requirePaths = GetStringCollectionOption(options, "RequiredPaths", ';', ',');
_hasSearchPaths = GetOption<object>(options, "SearchPaths", null) != null;
_standardLibraryPath = GetOption(options, "StandardLibrary", (string)null);
_applicationBase = GetOption(options, "ApplicationBase", (string)null);
}
开发者ID:TerabyteX,项目名称:main,代码行数:20,代码来源:RubyOptions.cs
示例15: AstGenerator
internal AstGenerator(RubyContext/*!*/ context, RubyCompilerOptions/*!*/ options, MSA.SymbolDocumentInfo document, RubyEncoding/*!*/ encoding,
bool printInteractiveResult) {
Assert.NotNull(context, options, encoding);
_context = context;
_compilerOptions = options;
_debugMode = context.DomainManager.Configuration.DebugMode;
_traceEnabled = context.RubyOptions.EnableTracing;
_document = document;
_sequencePointClearance = (document != null) ? Ast.ClearDebugInfo(document) : null;
_encoding = encoding;
_encodingConstant = Ast.Constant(encoding);
_profiler = context.RubyOptions.Profile ? Profiler.Instance : null;
_savingToDisk = context.RubyOptions.SavePath != null;
_printInteractiveResult = printInteractiveResult;
#if SILVERLIGHT
_debugCompiler = false;
#else
_debugCompiler = Snippets.Shared.SaveSnippets;
#endif
}
开发者ID:madpilot,项目名称:ironruby,代码行数:21,代码来源:AstGenerator.cs
示例16: IsDummy
public static bool IsDummy(RubyEncoding/*!*/ self) {
return false;
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:3,代码来源:RubyEncodingOps.cs
示例17: BasedEncoding
public static RubyEncoding BasedEncoding(RubyEncoding/*!*/ self) {
return null;
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:3,代码来源:RubyEncodingOps.cs
示例18: ToS
public static MutableString/*!*/ ToS(RubyEncoding/*!*/ self) {
return MutableString.CreateAscii(self.Name);
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:3,代码来源:RubyEncodingOps.cs
示例19: SetDefaultInternalEncoding
public static RubyEncoding/*!*/ SetDefaultInternalEncoding(RubyClass/*!*/ self, RubyEncoding encoding) {
// TODO:
return RubyEncoding.Default;
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:4,代码来源:RubyEncodingOps.cs
示例20: Test_Reverse
public void Test_Reverse(byte[]/*!*/ b, RubyEncoding/*!*/ e, byte[]/*!*/ expected) {
var s = MutableString.CreateBinary(b, e);
MutableStringOps.Reverse(s);
var actual = s.ToByteArray();
Assert(actual.ValueEquals(expected));
}
开发者ID:yarrow2,项目名称:ironruby,代码行数:6,代码来源:MutableStringTests.cs
注:本文中的IronRuby.Builtins.RubyEncoding类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论