1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Lazy-require state machine internals when the module is included

This commit is contained in:
Jeremy Kemper 2008-11-15 21:05:03 -08:00
parent d7bad6e2eb
commit 29a31912fc
3 changed files with 8 additions and 7 deletions

View file

@ -1,14 +1,10 @@
Dir[File.dirname(__FILE__) + "/state_machine/*.rb"].sort.each do |path|
filename = File.basename(path)
require "active_model/state_machine/#{filename}"
end
module ActiveModel
module StateMachine
class InvalidTransition < Exception
end
def self.included(base)
require 'active_model/state_machine/machine'
base.extend ClassMethods
end
@ -63,4 +59,4 @@ module ActiveModel
end
end
end
end
end

View file

@ -1,3 +1,5 @@
require 'active_model/state_machine/state_transition'
module ActiveModel
module StateMachine
class Event

View file

@ -1,3 +1,6 @@
require 'active_model/state_machine/state'
require 'active_model/state_machine/event'
module ActiveModel
module StateMachine
class Machine
@ -71,4 +74,4 @@ module ActiveModel
end
end
end
end
end