iZettle/api-model

View on GitHub
lib/api_model/initializer.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ApiModel
  module Initializer
    include ApiModel::Assignment
    extend ActiveSupport::Concern

    included do
      extend ActiveModel::Callbacks
      define_model_callbacks :initialize
    end

    def initialize(values={})
      run_callbacks :initialize do
        update_attributes values
      end
    end

  end
end