Sha256: 2d8b96ab4736dd50272fd34f861ce80dbc4565148061c39418dd03d072504b18
Contents?: true
Size: 651 Bytes
Versions: 9
Compression:
Stored size: 651 Bytes
Contents
module Acfs::Model # Initialization drop-in for pre-4.0 ActiveModel. # module Initialization # Initializes a new model with the given +params+. # # 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 # def initialize(params={}) params.each do |attr, value| self.public_send("#{attr}=", value) end if params end end end
Version data entries
9 entries across 9 versions & 1 rubygems