Class: Arrow::Column

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/arrow/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container, index) ⇒ Column

Returns a new instance of Column.



25
26
27
28
29
30
# File 'lib/arrow/column.rb', line 25

def initialize(container, index)
  @container = container
  @index = index
  @field = @container.schema[@index]
  @data = @container.get_column_data(@index)
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



22
23
24
# File 'lib/arrow/column.rb', line 22

def container
  @container
end

#dataObject (readonly)

Returns the value of attribute data.



24
25
26
# File 'lib/arrow/column.rb', line 24

def data
  @data
end

#fieldObject (readonly)

Returns the value of attribute field.



23
24
25
# File 'lib/arrow/column.rb', line 23

def field
  @field
end

Instance Method Details

#==(other) ⇒ Object



70
71
72
73
74
# File 'lib/arrow/column.rb', line 70

def ==(other)
  other.is_a?(self.class) and
    @field == other.field and
    @data == other.data
end

#[](i) ⇒ Object



48
49
50
# File 'lib/arrow/column.rb', line 48

def [](i)
  @data[i]
end

#data_typeObject



36
37
38
# File 'lib/arrow/column.rb', line 36

def data_type
  @field.data_type
end

#each(&block) ⇒ Object



52
53
54
# File 'lib/arrow/column.rb', line 52

def each(&block)
  @data.each(&block)
end

#n_nullsObject



66
67
68
# File 'lib/arrow/column.rb', line 66

def n_nulls
  @data.n_nulls
end

#n_rowsObject Also known as: size, length



60
61
62
# File 'lib/arrow/column.rb', line 60

def n_rows
  @data.n_rows
end

#nameObject



32
33
34
# File 'lib/arrow/column.rb', line 32

def name
  @field.name
end

#null?(i) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/arrow/column.rb', line 40

def null?(i)
  @data.null?(i)
end

#reverse_each(&block) ⇒ Object



56
57
58
# File 'lib/arrow/column.rb', line 56

def reverse_each(&block)
  @data.reverse_each(&block)
end

#valid?(i) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/arrow/column.rb', line 44

def valid?(i)
  @data.valid?(i)
end