Sha256: 63c83f4ba472a1f48f74a66021ea79aecefdea4c8d3436a6e28cce10c4417f8c

Contents?: true

Size: 526 Bytes

Versions: 1

Compression:

Stored size: 526 Bytes

Contents

require 'iconv' unless "older_ruby?".respond_to?(:force_encoding)

class PT::DataRow

  attr_accessor :num, :record, :state

  def initialize(orig, dataset)
    @record = orig
    @num = dataset.index(orig) + 1
    @state = orig.current_state
  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

1 entries across 1 versions & 1 rubygems

Version Path
pt-0.7.2 lib/pt/data_row.rb