Sha256: 76d3c319a91b1f156b08e840e54f66505cfdc4509d4cf7641f958ae8cf1315f9
Contents?: true
Size: 778 Bytes
Versions: 83
Compression:
Stored size: 778 Bytes
Contents
module Acfs::Model # Initialization drop-in for pre-4.0 ActiveModel. # module Initialization # @api public # # Initializes a new model with the given `params`. # # @example # class User # include Acfs::Model # attribute :name # attribute :email, default: -> { "#{name}@dom.tld" } # attribute :age, :integer, default: 18 # end # # user = User.new(name: 'bob') # user.name # => "bob" # user.email # => "bob@dom.tld" # user.age # => 18 # # @param [ Hash{ Symbol => Object } ] params Attributes to set on resource. # def initialize(params = {}) params.each do |attr, value| self.public_send("#{attr}=", value) end if params end end end
Version data entries
83 entries across 83 versions & 1 rubygems