Class: Philiprehberger::TestFactory::TransientCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/philiprehberger/test_factory/definition_proxy.rb

Overview

Collects transient attribute declarations via method_missing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTransientCollector

Returns a new instance of TransientCollector.



64
65
66
# File 'lib/philiprehberger/test_factory/definition_proxy.rb', line 64

def initialize
  @attributes = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)



70
71
72
73
74
75
76
# File 'lib/philiprehberger/test_factory/definition_proxy.rb', line 70

def method_missing(name, *args)
  if args.length == 1
    @attributes[name] = args.first
  else
    super
  end
end

Instance Attribute Details

#attributesHash (readonly)

Returns collected attributes.

Returns:

  • (Hash)

    collected attributes



62
63
64
# File 'lib/philiprehberger/test_factory/definition_proxy.rb', line 62

def attributes
  @attributes
end