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:
parent
d7bad6e2eb
commit
29a31912fc
3 changed files with 8 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'active_model/state_machine/state_transition'
|
||||
|
||||
module ActiveModel
|
||||
module StateMachine
|
||||
class Event
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue