Class: CALazyMarker

Inherits:
Object
  • Object
show all
Defined in:
lib/carray/lazy.rb

Instance Method Summary collapse

Instance Method Details

#dump_tree(indent = 0) ⇒ String

Returns an ASCII summary of the marker and its parent entity.

Returns:

  • (String)


750
751
752
753
754
# File 'lib/carray/lazy.rb', line 750

def dump_tree(indent = 0)
  pad = "  " * indent
  "#{pad}lazy(marker)\n" \
    "#{"  " * (indent + 1)}#{parent.class}(#{parent.data_type_name}, #{parent.shape.inspect})\n"
end

#each({ |value| ... }) ⇒ Object

Yields each element of the wrapped entity (no materialise needed).

Returns:

  • (Object)


760
761
762
# File 'lib/carray/lazy.rb', line 760

def each(&block)
  parent.each(&block)
end

#inspectString

Returns a short summary showing the wrapped entity.

Returns:

  • (String)


736
737
738
# File 'lib/carray/lazy.rb', line 736

def inspect
  "#<CALazyMarker over #{parent.inspect}>"
end

#to_aArray

Returns the wrapped entity's Array.

Returns:



767
768
769
# File 'lib/carray/lazy.rb', line 767

def to_a
  parent.to_a
end

#to_memory_viewObject

Not supported: markers do not own a backing buffer.

Raises:

  • (TypeError)

    always; call .copy first.

Raises:

  • (TypeError)


774
775
776
777
778
779
# File 'lib/carray/lazy.rb', line 774

def to_memory_view
  raise TypeError,
        "lazy marker (CALazyMarker) has no backing buffer; call " \
        "`.copy` first to materialise into an entity before " \
        "exporting via MemoryView."
end

#to_sString

Alias of #inspect.

Returns:

  • (String)


743
744
745
# File 'lib/carray/lazy.rb', line 743

def to_s
  inspect
end