Method: Praxis::ResourceDefinition::ClassMethods#action

Defined in:
lib/praxis/resource_definition.rb

#action(name, &block) ⇒ Object

Raises:

  • (ArgumentError)


116
117
118
119
120
# File 'lib/praxis/resource_definition.rb', line 116

def action(name, &block)
  raise ArgumentError, "can not create ActionDefinition without block" unless block_given?
  raise ArgumentError, "Action names must be defined using symbols (Got: #{name} (of type #{name.class}))" unless name.is_a? Symbol
  @actions[name] = ActionDefinition.new(name, self, &block)
end