Class: Transform
- Inherits:
-
Object
show all
- Defined in:
- app/transforms/transform.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(table, settings) ⇒ Transform
Returns a new instance of Transform.
16
17
18
19
|
# File 'app/transforms/transform.rb', line 16
def initialize(table, settings)
self.table = table
self.settings = (settings || {}).symbolize_keys
end
|
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
15
16
17
|
# File 'app/transforms/transform.rb', line 15
def settings
@settings
end
|
#table ⇒ Object
Returns the value of attribute table.
14
15
16
|
# File 'app/transforms/transform.rb', line 14
def table
@table
end
|
Class Method Details
.display_name ⇒ Object
7
8
9
|
# File 'app/transforms/transform.rb', line 7
def self.display_name
name.demodulize.underscore.humanize.titleize
end
|
10
11
12
|
# File 'app/transforms/transform.rb', line 10
def self.form_keys
[:columns] end
|
2
3
4
5
|
# File 'app/transforms/transform.rb', line 2
def self.transforms
DailyConfig.load_classes if Rails.env.development?
subclasses
end
|
Instance Method Details
#columns ⇒ Object
26
27
28
|
# File 'app/transforms/transform.rb', line 26
def columns
setting(:columns, []).collect(&:to_s)
end
|
#result ⇒ Object
30
31
32
|
# File 'app/transforms/transform.rb', line 30
def result
raise("Transforms must override result")
end
|
#setting(key, default = nil) ⇒ Object
21
22
23
24
|
# File 'app/transforms/transform.rb', line 21
def setting(key, default = nil)
val = settings[key.to_sym]
val.blank? ? default : val
end
|