Sha256: 474d9e59290a1a64e59589d918101ca42fc5db315bee826e7f043a3953f29621
Contents?: true
Size: 600 Bytes
Versions: 7
Compression:
Stored size: 600 Bytes
Contents
module CucumberFactory class UpdateStrategy def initialize(record) @record = record end def assign_attributes(attributes) active_record_strategy(attributes) || ruby_object_strategy(attributes) end private def active_record_strategy(attributes) return unless @record.respond_to?(:save!) CucumberFactory::Switcher.assign_attributes(@record, attributes) @record.save! end def ruby_object_strategy(attributes) attributes.each do |name, value| @record.send("#{name}=".to_sym, value) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems