Sha256: bbd49336add2cac93aadf30c2f3b3f42dae0e702bc4241f81e2c636b90176005

Contents?: true

Size: 678 Bytes

Versions: 7

Compression:

Stored size: 678 Bytes

Contents

class Transform
  def self.transforms
    DailyConfig.load_classes if Rails.env.development?
    subclasses
  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

7 entries across 7 versions & 1 rubygems

Version Path
daily-0.0.10 app/transforms/transform.rb
daily-0.0.9 app/transforms/transform.rb
daily-0.0.8 app/transforms/transform.rb
daily-0.0.7 app/transforms/transform.rb
daily-0.0.6 app/transforms/transform.rb
daily-0.0.5 app/transforms/transform.rb
daily-0.0.4 app/transforms/transform.rb