Permalink
Browse files

Use a more specialized type for collections of of children.

  • Loading branch information...
1 parent 6eea7e8 commit ed9f8e61928b5b88c732acfc5ae6c84a0d43b852 @nrk committed Jul 17, 2010
Showing with 17 additions and 15 deletions.
  1. +3 −3 src/Data/ElementData.cs
  2. +3 −2 src/Elements/Document.cs
  3. +3 −2 src/Elements/Element.cs
  4. +8 −8 src/Initializers.Generated.cs
View
@@ -1,16 +1,16 @@
using System;
+using System.Collections.Generic;
using IronRuby.Builtins;
namespace IronRuby.Hpricot {
public class ElementData : AttributeData {
- // TODO: RubyArray
- private Object _children;
+ private IList<Object> _children;
private Object _etag;
private Object _raw;
private Object _ec;
private Int32 _name;
- public Object Children {
+ public IList<Object> Children {
get { return _children; }
set { _children = value; }
}
View
@@ -1,5 +1,6 @@
using System;
using System.Text;
+using System.Collections.Generic;
using IronRuby.Builtins;
using IronRuby.Runtime;
using Microsoft.Scripting;
@@ -34,12 +35,12 @@ public Document(RubyContext context)
}
[RubyMethod("children")]
- public static Object GetChildren(Document/*!*/ self) {
+ public static IList<Object> GetChildren(Document/*!*/ self) {
return self._data.Children;
}
[RubyMethod("children=")]
- public static void SetChildren(Document/*!*/ self, Object/*!*/ children) {
+ public static void SetChildren(Document/*!*/ self, IList<Object>/*!*/ children) {
self._data.Children = children;
}
}
View
@@ -1,5 +1,6 @@
using System;
using System.Text;
+using System.Collections.Generic;
using IronRuby.Builtins;
using IronRuby.Runtime;
using Microsoft.Scripting;
@@ -43,12 +44,12 @@ public Element(RubyContext context)
}
[RubyMethod("children")]
- public static Object GetChildren(Element/*!*/ self) {
+ public static IList<Object> GetChildren(Element/*!*/ self) {
return (self._data as ElementData).Children;
}
[RubyMethod("children=")]
- public static void SetChildren(Element/*!*/ self, Object/*!*/ children) {
+ public static void SetChildren(Element/*!*/ self, IList<Object>/*!*/ children) {
(self._data as ElementData).Children = children;
}
@@ -133,13 +133,13 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__Doc_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "children", 0x11,
- 0x00000000U,
- new Func<IronRuby.Hpricot.Document, System.Object>(IronRuby.Hpricot.Document.GetChildren)
+ 0x00000000U,
+ new Func<IronRuby.Hpricot.Document, System.Collections.Generic.IList<Object>>(IronRuby.Hpricot.Document.GetChildren)
);
DefineLibraryMethod(module, "children=", 0x11,
- 0x00000000U,
- new Action<IronRuby.Hpricot.Document, System.Object>(IronRuby.Hpricot.Document.SetChildren)
+ 0x00000000U,
+ new Action<IronRuby.Hpricot.Document, System.Collections.Generic.IList<Object>>(IronRuby.Hpricot.Document.SetChildren)
);
}
@@ -179,13 +179,13 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__Elem_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "children", 0x11,
- 0x00000000U,
- new Func<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.GetChildren)
+ 0x00000000U,
+ new Func<IronRuby.Hpricot.Element, System.Collections.Generic.IList<Object>>(IronRuby.Hpricot.Element.GetChildren)
);
DefineLibraryMethod(module, "children=", 0x11,
- 0x00000000U,
- new Action<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.SetChildren)
+ 0x00000000U,
+ new Action<IronRuby.Hpricot.Element, System.Collections.Generic.IList<Object>>(IronRuby.Hpricot.Element.SetChildren)
);
DefineLibraryMethod(module, "clear_raw", 0x11,

0 comments on commit ed9f8e6

Please sign in to comment.