Sha256: bc5ffdeff0272b83d53e2ac66722c0977062cdc8f78971fbe50766400b171da6
Contents?: true
Size: 330 Bytes
Versions: 1
Compression:
Stored size: 330 Bytes
Contents
module InitialValuer extend ActiveSupport::Concern class_methods do def initial_value_for(attribute, value) builder = Sinclair.new(self, initial_value: value) builder.eval_and_add_method(attribute) do "@#{attribute} ||= #{options_object.initial_value}" end builder.build end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinclair-1.1.1 | spec/support/models/initial_valuer.rb |