Sha256: 4e8f60c933327ddc435a02fe592f4c7c13ce120ae29234a335060b136e26b199

Contents?: true

Size: 322 Bytes

Versions: 9

Compression:

Stored size: 322 Bytes

Contents

class SimpleCommand < Mutations::Command

  required do
    string :name, :max_length => 10
    string :email
  end

  optional do
    integer :amount
  end

  def validate
    unless email && email.include?('@')
      add_error(:email, :invalid, 'Email must contain @')
    end
  end

  def execute
    inputs
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mutations-0.9.1 spec/simple_command.rb
mutations-0.9.0 spec/simple_command.rb
mutations-0.8.3 spec/simple_command.rb
mutations-0.8.2 spec/simple_command.rb
mutations-0.8.1 spec/simple_command.rb
mutations-0.8.0 spec/simple_command.rb
mutations-0.7.2 spec/simple_command.rb
mutations-0.7.1 spec/simple_command.rb
mutations-0.7.0 spec/simple_command.rb