Sha256: 0d694aeebec1fe7957b87e55977627f8e2043a7b28cdc84a8a32ca423740314d

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

class Transform
  def self.transforms
    [ColumnFilter, MovingAverage]
  end
  
  def self.display_name
    name.demodulize.underscore.humanize.titleize
  end
  def self.form_keys
    [:columns]  # override to get more / different
  end
    
  attr_accessor :table
  attr_accessor :settings
  def initialize(table, settings)
    self.table = table
    self.settings = (settings || {}).symbolize_keys
  end

  def setting(key, default = nil)
    val = settings[key.to_sym]
    val.blank? ? default : val
  end

  def columns
    setting(:columns, []).collect(&:to_s)
  end

  def result
    raise("Transforms must override result")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
daily-0.0.3 app/transforms/transform.rb
daily-0.0.2 app/transforms/transform.rb