Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Lazy-require state machine internals when the module is included

  • Loading branch information...
commit 29a31912fcedde9e271af8a20b890f8c62e1ea79 1 parent d7bad6e
@jeremy jeremy authored
View
8 activemodel/lib/active_model/state_machine.rb
@@ -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 @@ def current_state(name = nil, new_state = nil, persist = false)
end
end
end
-end
+end
View
2  activemodel/lib/active_model/state_machine/event.rb
@@ -1,3 +1,5 @@
+require 'active_model/state_machine/state_transition'
+
module ActiveModel
module StateMachine
class Event
View
5 activemodel/lib/active_model/state_machine/machine.rb
@@ -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 @@ def event_failed_callback
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.