Skip to content

Commit

Permalink
Add #to_ary to Native::Array and improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Sep 16, 2013
1 parent 8d1443f commit 35199e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion corelib/native.rb
Expand Up @@ -55,7 +55,7 @@ def initialize(native, options = {}, &block)
@length = options[:length] || :length
@block = block

if `#@native[#@length] == null`
if `#{length} == null`
raise ArgumentError, "no length found on the array-like object"
end
end
Expand Down Expand Up @@ -102,6 +102,8 @@ def []=(index, value)
def length
`#@native[#@length]`
end

alias to_ary to_a
end

def self.try_convert(value)
Expand Down

0 comments on commit 35199e5

Please sign in to comment.