Skip to content

Commit

Permalink
Use delegation from AS
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Oct 15, 2011
1 parent 180eb8b commit 9e88eb1
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions lib/factory_girl/factory.rb
@@ -1,4 +1,5 @@
require "active_support/core_ext/hash/keys"
require "active_support/core_ext/module/delegation"
require "active_support/inflector"

module FactoryGirl
Expand All @@ -18,6 +19,8 @@ def initialize(name, options = {}) #:nodoc:
@compiled = false
end

delegate :overridable?, :declarations, :declare_attribute, :to => :@attribute_list

def factory_name
$stderr.puts "DEPRECATION WARNING: factory.factory_name is deprecated; use factory.name instead."
name
Expand All @@ -37,10 +40,6 @@ def allow_overrides
self
end

def allow_overrides?
@attribute_list.overridable?
end

def define_trait(trait)
@defined_traits << trait
end
Expand Down Expand Up @@ -132,10 +131,6 @@ def ensure_compiled
compile unless @compiled
end

def declare_attribute(declaration)
@attribute_list.declare_attribute(declaration)
end

protected

def class_name #:nodoc:
Expand Down Expand Up @@ -174,11 +169,7 @@ def compile

def inherit_factory(parent) #:nodoc:
parent.ensure_compiled
allow_overrides if parent.allow_overrides?
end

def declarations
@attribute_list.declarations
allow_overrides if parent.overridable?
end

def define_attribute(attribute)
Expand Down

0 comments on commit 9e88eb1

Please sign in to comment.