Class: Moon::MatrixLike::TableAdaptor

Inherits:
Object
  • Object
show all
Includes:
Tabular
Defined in:
lib/moon/packages/data_bags/matrix_like/table_adaptor.rb

Overview

A wrapper class around a DataMatrix instance to allow Table like behaviour

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Tabular

#contains?, #iter, #map_with_xy, #rect, #set_by_dict, #sizes

Constructor Details

#initialize(src) ⇒ TableAdaptor

Returns a new instance of TableAdaptor.

Parameters:


13
14
15
16
# File 'lib/moon/packages/data_bags/matrix_like/table_adaptor.rb', line 13

def initialize(src)
  @src = src
  @z = 0
end

Instance Attribute Details

#srcMoon::MatrixLike (readonly)

Returns:


8
9
10
# File 'lib/moon/packages/data_bags/matrix_like/table_adaptor.rb', line 8

def src
  @src
end

#zInteger

Returns:


10
11
12
# File 'lib/moon/packages/data_bags/matrix_like/table_adaptor.rb', line 10

def z
  @z
end

Instance Method Details

#[](x, y) ⇒ Integer

Parameters:

Returns:


31
32
33
# File 'lib/moon/packages/data_bags/matrix_like/table_adaptor.rb', line 31

def [](x, y)
  src[x, y, z]
end

#[]=(x, y, value) ⇒ Object

Parameters:


38
39
40
# File 'lib/moon/packages/data_bags/matrix_like/table_adaptor.rb', line 38

def []=(x, y, value)
  src[x, y, z] = value
end

#xsizeInteger

Returns:


19
20
21
# File 'lib/moon/packages/data_bags/matrix_like/table_adaptor.rb', line 19

def xsize
  src.xsize
end

#ysizeInteger

Returns:


24
25
26
# File 'lib/moon/packages/data_bags/matrix_like/table_adaptor.rb', line 24

def ysize
  src.ysize
end