Sha256: 888def7fabb10bfd48ddee4d461141506e62dcb17c6fcad9f2d96f88928bf754
Contents?: true
Size: 745 Bytes
Versions: 4
Compression:
Stored size: 745 Bytes
Contents
# frozen_string_literal: true class Acfs::Resource # # Initialization drop-in for pre-4.0 ActiveModel. # module Initialization # # @api public # # Initializes a new model with the given `params`. fff # # @example # class User < Acfs::Resource # 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 params [Hash{Symbol => Object}] Attributes to set on resource. # def initialize(params = {}) write_attributes params if params end end end
Version data entries
4 entries across 4 versions & 1 rubygems