/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. using IronRuby.Runtime;
  16. using Microsoft.Scripting.Utils;
  17. using IronRuby.Compiler.Generation;
  18. using System.Collections.Generic;
  19. using System.Diagnostics;
  20. namespace IronRuby.Builtins {
  21. public partial class Hash {
  22. public sealed partial class Subclass : Hash, IRubyObject {
  23. // called by Class#new rule when creating a Ruby subclass of String:
  24. public Subclass(RubyClass/*!*/ rubyClass)
  25. : base(rubyClass.Context) {
  26. Assert.NotNull(rubyClass);
  27. Debug.Assert(!rubyClass.IsSingletonClass);
  28. ImmediateClass = rubyClass;
  29. }
  30. protected override Hash/*!*/ CreateInstance() {
  31. return new Subclass(ImmediateClass.NominalClass);
  32. }
  33. }
  34. }
  35. }