Sha256: 39ae1faca5a8a8a44fb68b0040818ba691d7f2b4c146463543416884472fca76
Contents?: true
Size: 632 Bytes
Versions: 2
Compression:
Stored size: 632 Bytes
Contents
# frozen_string_literal: true module Fixturizer module Engines class Record def initialize(value:, rule:) # @configuration = Fixturizer::Configuration::new filename: './config/rules.yml' @configuration = Fixturizer::Services.get.configuration @rules = @configuration.rules @record = value @rule = rule.is_a?(Symbol) ? @rules[rule] : rule end def apply result = @record return result if @rule.nil? result = eval("lambda { #{@rule[:proc]} } ").call unless (@rule[:preserve] == true) && !@record.nil? result end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fixturizer-0.4.4 | lib/fixturizer/engines/records.rb |
fixturizer-0.4.3 | lib/fixturizer/engines/records.rb |