Class: FactoryGirl::DeclarationList Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/factory_girl/declaration_list.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary (collapse)

Constructor Details

- (DeclarationList) initialize(name = nil)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DeclarationList



6
7
8
9
10
# File 'lib/factory_girl/declaration_list.rb', line 6

def initialize(name = nil)
  @declarations = []
  @name         = name
  @overridable  = false
end

Instance Method Details

- (Object) attributes

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
# File 'lib/factory_girl/declaration_list.rb', line 23

def attributes
  @attributes ||= AttributeList.new(@name).tap do |list|
    to_attributes.each do |attribute|
      list.define_attribute(attribute)
    end
  end
end

- (Object) declare_attribute(declaration)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
15
16
17
# File 'lib/factory_girl/declaration_list.rb', line 12

def declare_attribute(declaration)
  delete_declaration(declaration) if overridable?

  @declarations << declaration
  declaration
end

- (Object) each(&block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/factory_girl/declaration_list.rb', line 31

def each(&block)
  @declarations.each(&block)
end

- (Object) overridable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/factory_girl/declaration_list.rb', line 19

def overridable
  @overridable = true
end