Sha256: 5d0222dedb07085095ae9b275fff9540200acbed0ab92fc47b4e2b1a8e997d2f
Contents?: true
Size: 656 Bytes
Versions: 2
Compression:
Stored size: 656 Bytes
Contents
module JsonApiClient module Helpers module Initializable extend ActiveSupport::Concern included do class_attribute :initializers, instance_accessor: false self.initializers = [] end module ClassMethods def initializer(method = nil, &block) self.initializers.push(method || block) end end def initialize(params = {}) self.class.initializers.each do |initializer| if initializer.respond_to?(:call) initializer.call(self, params) else self.send(initializer, params) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
json_api_client-1.0.0.beta5 | lib/json_api_client/helpers/initializable.rb |
json_api_client-1.0.0.beta4 | lib/json_api_client/helpers/initializable.rb |