Sha256: 78227c776e19095371b7258864034432479bcfad8747f3e3266242445a368516

Contents?: true

Size: 436 Bytes

Versions: 3

Compression:

Stored size: 436 Bytes

Contents

require 'iconv'

class PT::DataRow

  attr_accessor :num, :record

  def initialize(orig, dataset)
    @record = orig
    @num = dataset.index(orig) + 1
  end

  def method_missing(method)
    str = @record.send(method).to_s
    str.respond_to?(:force_encoding) ? str.force_encoding('utf-8') : Iconv.iconv('UTF-8', 'UTF-8', str)
  end

  def to_s
    @record.send(self.to_s_attribute)
  end

  def to_s_attribute
    @n.to_s
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pt-0.5 lib/pt/data_row.rb
pt-0.3.9 lib/pt/data_row.rb
pt-0.3.8 lib/pt/data_row.rb