class BerkeleyLibrary::TIND::Export::Column

Attributes

col_in_group[R]

@return [Integer] the index of this column in the group

column_group[R]

@return [ColumnGroup] the group containing this column

Public Class Methods

new(column_group, col_in_group) click to toggle source

Initializes a new column

@param column_group [ColumnGroup] the group containing this column @param col_in_group [Integer] the index of this column in the group

# File lib/berkeley_library/tind/export/column.rb, line 18
def initialize(column_group, col_in_group)
  @column_group = column_group
  @col_in_group = col_in_group
end

Public Instance Methods

can_edit?() click to toggle source
# File lib/berkeley_library/tind/export/column.rb, line 36
def can_edit?
  @can_edit ||= Filter.can_edit?(
    column_group.tag,
    column_group.ind1,
    column_group.ind2,
    subfield_code
  )
end
each_value(include_header: false) { |header| ... } click to toggle source
# File lib/berkeley_library/tind/export/column.rb, line 45
def each_value(include_header: false)
  return to_enum(:each_value, include_header: include_header) unless block_given?

  yield header if include_header
  column_group.row_count.times { |row| yield value_at(row) }
end
header() click to toggle source
# File lib/berkeley_library/tind/export/column.rb, line 23
def header
  # NOTE: that TIND "-#" suffixes must be unique by tag, not tag + ind1 + ind2
  @header ||= "#{column_group.prefix}#{subfield_code}-#{1 + column_group.index_in_tag}"
end
subfield_code() click to toggle source
# File lib/berkeley_library/tind/export/column.rb, line 28
def subfield_code
  @subfield_code ||= column_group.subfield_codes[col_in_group]
end
value_at(row) click to toggle source
# File lib/berkeley_library/tind/export/column.rb, line 32
def value_at(row)
  column_group.value_at(row, col_in_group)
end