Skip to content

Commit 35199e5

Browse files
committed
Add #to_ary to Native::Array and improve code
1 parent 8d1443f commit 35199e5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

corelib/native.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def initialize(native, options = {}, &block)
5555
@length = options[:length] || :length
5656
@block = block
5757

58-
if `#@native[#@length] == null`
58+
if `#{length} == null`
5959
raise ArgumentError, "no length found on the array-like object"
6060
end
6161
end
@@ -102,6 +102,8 @@ def []=(index, value)
102102
def length
103103
`#@native[#@length]`
104104
end
105+
106+
alias to_ary to_a
105107
end
106108

107109
def self.try_convert(value)

0 commit comments

Comments
 (0)