Sha256: 3c0b64b105e90c4f5399433b78d6343d573dd8cc84ec1fbc356f10e6eff06724

Contents?: true

Size: 409 Bytes

Versions: 1

Compression:

Stored size: 409 Bytes

Contents

require 'simple_factory/definition'

module SimpleFactory
  class DSL
    attr_reader :definitions

    def initialize
      @definitions = []
    end

    def method_missing(name, *args, &block)
      unless args.size >= 1 || block
        raise ArgumentError, 'an argument or a block is required'
      end
      @definitions << Definition.new(name, (args.size >= 1 ? args.first : block))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_factory-0.1.0 lib/simple_factory/dsl.rb