Class: FakerMaker::DefinitionProxy

Inherits:
Object
  • Object
show all
Includes:
LifecycleHooks::DefinitionProxy
Defined in:
lib/faker_maker/definition_proxy.rb

Overview

Proxy for mapping attribute names

Instance Method Summary collapse

Methods included from LifecycleHooks::DefinitionProxy

#after_build, #before_build

Constructor Details

#initialize(factory) ⇒ DefinitionProxy

Returns a new instance of DefinitionProxy.



8
9
10
# File 'lib/faker_maker/definition_proxy.rb', line 8

def initialize(factory)
  @factory = factory
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



16
17
18
19
# File 'lib/faker_maker/definition_proxy.rb', line 16

def method_missing(name, *args, &block)
  attribute = FakerMaker::Attribute.new name, block, *args
  @factory.attach_attribute attribute
end

Instance Method Details

#faker_maker_factoryObject



12
13
14
# File 'lib/faker_maker/definition_proxy.rb', line 12

def faker_maker_factory
  @factory
end

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

Returns:

  • (Boolean)


21
22
23
# File 'lib/faker_maker/definition_proxy.rb', line 21

def respond_to_missing?(method_name, include_private = false)
  super
end