PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Languages/Ruby/Ruby/Builtins/Hash.Subclass.cs

#
C# | 38 lines | 20 code | 3 blank | 15 comment | 0 complexity | 108f09f6bbdaeecc0d493ab841cdc5dd MD5 | raw file
 1/* ****************************************************************************
 2 *
 3 * Copyright (c) Microsoft Corporation. 
 4 *
 5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A 
 6 * copy of the license can be found in the License.html file at the root of this distribution. If 
 7 * you cannot locate the  Apache License, Version 2.0, please send an email to 
 8 * ironruby@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 9 * by the terms of the Apache License, Version 2.0.
10 *
11 * You must not remove this notice, or any other, from this software.
12 *
13 *
14 * ***************************************************************************/
15
16using IronRuby.Runtime;
17using Microsoft.Scripting.Utils;
18using IronRuby.Compiler.Generation;
19using System.Collections.Generic;
20using System.Diagnostics;
21
22namespace IronRuby.Builtins {
23    public partial class Hash {
24        public sealed partial class Subclass : Hash, IRubyObject {
25            // called by Class#new rule when creating a Ruby subclass of String:
26            public Subclass(RubyClass/*!*/ rubyClass) 
27                : base(rubyClass.Context) {
28                Assert.NotNull(rubyClass);
29                Debug.Assert(!rubyClass.IsSingletonClass);
30                ImmediateClass = rubyClass;
31            }
32
33            protected override Hash/*!*/ CreateInstance() {
34                return new Subclass(ImmediateClass.NominalClass);
35            }
36        }
37    }
38}