Method: Abstractivator::Lazy#to_a

Defined in:
lib/abstractivator/lazy.rb

#to_aObject

Force ruby to delegate to wrapped object. Ruby’s C implementation makes assumptions about object type. This is required for explicit array coercion:

x = 1
a = *x
(a == [1])


63
64
65
66
67
68
69
70
# File 'lib/abstractivator/lazy.rb', line 63

def to_a
  __lazy_ensure_obj
  if @obj.respond_to?(:to_a)
    @obj.to_a
  else
    nil
  end
end