def state(*names, &block)
options = names.last.is_a?(Hash) ? names.pop : {}
assert_valid_keys(options, :value, :cache, :if, :human_name)
states = add_states(names)
states.each do |state|
if options.include?(:value)
state.value = options[:value]
self.states.update(state)
end
state.human_name = options[:human_name] if options.include?(:human_name)
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