Sha256: 96676f0547881368cf157b349b59479970ed4dae5f296ca53c9d29cde37667b1
Contents?: true
Size: 384 Bytes
Versions: 1
Compression:
Stored size: 384 Bytes
Contents
module PivotTable class Row ACCESSORS = [:header, :data, :value_name] ACCESSORS.each do |a| self.send(:attr_accessor, a) end def initialize(options = {}) ACCESSORS.each do |a| self.send("#{a}=", options[a]) if options.has_key?(a) end end def total data.inject(0){|t,x| t + (x ? x.send(value_name) : 0)} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pivot_table-0.1.3 | lib/pivot_table/row.rb |