Sha256: 776ae755665f37a1b9daf6c975d3ce21b14a4fa7f57f4e4eb3d5395ac2637280

Contents?: true

Size: 343 Bytes

Versions: 3

Compression:

Stored size: 343 Bytes

Contents

module AutoError
  class AppErrorDecorator < Draper::Decorator
    def as_json
      r = source.attributes
      (r['data']||{}).entries.each do |k, v|
        next if v.nil?
        handler = AutoError::Config.data_handlers[k.to_sym].bind(ViewContext.new)
        r['data'][k.to_s] = handler.(v).html_safe
      end
      r
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auto_error-0.0.3 app/decorators/auto_error/app_error_decorator.rb
auto_error-0.0.2 app/decorators/auto_error/app_error_decorator.rb
auto_error-0.0.1 app/decorators/auto_error/app_error_decorator.rb