Sha256: 9edc45ce019a348bb498041138bab8176384224cb2755e4115e245f978966d2c

Contents?: true

Size: 494 Bytes

Versions: 8

Compression:

Stored size: 494 Bytes

Contents

# encoding: utf-8
#
# Copyright (C) 2011-2012  AdMaster, Inc.

module Apimaster::Test

  class Factory
    def self.define name, value = nil
      self.attrs[name] = value
    end

    def self.attrs
      @attrs ||= {}
    end

    def self.attr key
      @attrs ||= {}
      @attrs[key]
    end

    def self.register name
      @klass = name
    end

    def self.post data = {}
      raise "Please register class first." unless @klass
      @klass.post attrs.merge(data)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
apimaster-0.1.4 lib/apimaster/test/factory.rb
apimaster-0.1.3 lib/apimaster/test/factory.rb
apimaster-0.1.2 lib/apimaster/test/factory.rb
apimaster-0.1.1 lib/apimaster/test/factory.rb
apimaster-0.0.7 lib/apimaster/test/factory.rb
apimaster-0.0.6 lib/apimaster/test/factory.rb
apimaster-0.0.5 lib/apimaster/test/factory.rb
apimaster-0.0.4 lib/apimaster/test/factory.rb