Sha256: 6fb769ef75106889aaed3fbce65defea04f8f76b14772bbdb6b7afeb0091a91f

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

module FactoryFactoryGirl
  class << self
    attr_accessor :configuration

    def configure
      self.configuration ||= Configuration.new
      yield(configuration) if block_given?
    end
  end

  class Configuration
    attr_accessor :rules, :rails_options

    def initialize
      @rules = []
      @rails_options = {}
    end

    def match(rule, value: nil, function: nil)
      raise "Need to give attribute or process" if                 value.nil? && function.nil?

      if value
        rules << { rule: rule, value: value }
      else
        rules << { rule: rule, function: function }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
factory_factory_girl-0.1.6 lib/factory_factory_girl/configuration.rb
factory_factory_girl-0.1.5 lib/factory_factory_girl/configuration.rb