Sha256: 5baceced8e350d3155a6590d90e6988d8c954109990c02ea0d11d93c9846ab41

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 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(pattern, value: nil, function: nil)
      raise "Need to give attribute or process" if value.nil? && function.nil?

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
factory_factory_girl-0.1.7 lib/factory_factory_girl/configuration.rb