# File lib/state_machine/machine.rb, line 822 def state(*names, &block) options = names.last.is_a?(Hash) ? names.pop : {} assert_valid_keys(options, :value, :cache, :if) states = add_states(names) states.each do |state| if options.include?(:value) state.value = options[:value] self.states.update(state) end state.cache = options[:cache] if options.include?(:cache) state.matcher = options[:if] if options.include?(:if) state.context(&block) if block_given? end states.length == 1 ? states.first : states end