Sha256: febe74305bc5884a2d3f069cba75ae6ae295391f8bb149ef5aff3310de81334c

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 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
    if defined? orig.current_state
      @state = orig.current_state
    end
  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.3 lib/pt/data_row.rb