aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/state_machine/state.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2010-01-30 18:38:01 -0600
committerJoshua Peek <josh@joshpeek.com>2010-01-30 18:38:01 -0600
commitdb49c706b62e7ea2ab93f05399dbfddf5087ee0c (patch)
tree7f369bd2b77d620e344f19ba8156c597e2493f58 /activemodel/lib/active_model/state_machine/state.rb
parent657d85580e914caf368a8a12ff5642e4d979ab7e (diff)
downloadrails-db49c706b62e7ea2ab93f05399dbfddf5087ee0c.tar.gz
rails-db49c706b62e7ea2ab93f05399dbfddf5087ee0c.tar.bz2
rails-db49c706b62e7ea2ab93f05399dbfddf5087ee0c.zip
Axe AM state machine
We're going do it eventually, get it done before 3.0 is final.
Diffstat (limited to 'activemodel/lib/active_model/state_machine/state.rb')
-rw-r--r--activemodel/lib/active_model/state_machine/state.rb47
1 files changed, 0 insertions, 47 deletions
diff --git a/activemodel/lib/active_model/state_machine/state.rb b/activemodel/lib/active_model/state_machine/state.rb
deleted file mode 100644
index 76916b1d86..0000000000
--- a/activemodel/lib/active_model/state_machine/state.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-module ActiveModel
- module StateMachine
- class State
- attr_reader :name, :options
-
- def initialize(name, options = {})
- @name = name
- if machine = options.delete(:machine)
- machine.klass.define_state_query_method(name)
- end
- update(options)
- end
-
- def ==(state)
- if state.is_a? Symbol
- name == state
- else
- name == state.name
- end
- end
-
- def call_action(action, record)
- action = @options[action]
- case action
- when Symbol, String
- record.send(action)
- when Proc
- action.call(record)
- end
- end
-
- def display_name
- @display_name ||= name.to_s.gsub(/_/, ' ').capitalize
- end
-
- def for_select
- [display_name, name.to_s]
- end
-
- def update(options = {})
- if options.key?(:display) then @display_name = options.delete(:display) end
- @options = options
- self
- end
- end
- end
-end