Class: FactoryBot::Decorator

Inherits:
BasicObject
Defined in:
lib/factory_bot/decorator.rb,
lib/factory_bot/decorator/attribute_hash.rb,
lib/factory_bot/decorator/new_constructor.rb,
lib/factory_bot/decorator/invocation_tracker.rb,
lib/factory_bot/decorator/disallows_duplicates_registry.rb

Defined Under Namespace

Classes: AttributeHash, DisallowsDuplicatesRegistry, InvocationTracker, NewConstructor

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component) ⇒ Decorator

Returns a new instance of Decorator.



5
6
7
# File 'lib/factory_bot/decorator.rb', line 5

def initialize(component)
  @component = component
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject

rubocop:disable Style/MethodMissingSuper



9
10
11
# File 'lib/factory_bot/decorator.rb', line 9

def method_missing(...) # rubocop:disable Style/MethodMissingSuper
  @component.send(...)
end

Class Method Details

.const_missing(name) ⇒ Object



21
22
23
# File 'lib/factory_bot/decorator.rb', line 21

def self.const_missing(name)
  ::Object.const_get(name)
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/factory_bot/decorator.rb', line 17

def respond_to_missing?(name, include_private = false)
  @component.respond_to?(name, true) || super
end

#sendObject



13
14
15
# File 'lib/factory_bot/decorator.rb', line 13

def send(...)
  __send__(...)
end