Module: Obfuscator::Dsl::ClassMethods
- Defined in:
- lib/obfuscator/dsl.rb
Instance Method Summary collapse
- #columns ⇒ Object
- #format(format) ⇒ Object
- #overwrite(*columns, &block) ⇒ Object
- #scrub!(model, &block) ⇒ Object
Instance Method Details
#columns ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/obfuscator/dsl.rb', line 26 def columns if @columns.is_a?(Array) @columns.flatten.uniq else @columns end end |
#format(format) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/obfuscator/dsl.rb', line 34 def format(format) if @columns_hash.present? @columns = @columns_hash.merge(columns.first => format) else @columns = { columns.first => format } @columns_hash = @columns end end |
#overwrite(*columns, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/obfuscator/dsl.rb', line 12 def overwrite(*columns, &block) if block_given? @columns = columns return instance_eval(&block) end if columns.length == 1 @columns.push(columns.first) else @columns.push(columns) end end |
#scrub!(model, &block) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/obfuscator/dsl.rb', line 4 def scrub!(model, &block) instance_eval(&block) obfuscator = Obfuscator::Generic.new obfuscator.scrub!(model, columns) end |