Class: Chief::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/chief/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(*args) ⇒ Object



3
4
5
# File 'lib/chief/command.rb', line 3

def self.call(*args)
  new(*args).call
end

.value(*args) ⇒ Object



7
8
9
# File 'lib/chief/command.rb', line 7

def self.value(*args)
  call(*args).value
end

Instance Method Details

#callObject



11
12
13
# File 'lib/chief/command.rb', line 11

def call
  fail NotImplementedError, 'Implement #call in subclass'
end

#fail!(value = false, errors = true) ⇒ Object



19
20
21
# File 'lib/chief/command.rb', line 19

def fail!(value = false, errors = true)
  Result.new(value, errors)
end

#success!(value = true) ⇒ Object



15
16
17
# File 'lib/chief/command.rb', line 15

def success!(value = true)
  Result.new(value, nil)
end