Module: SimpleCommand

Defined in:
lib/simple_command.rb,
lib/simple_command/errors.rb,
lib/simple_command/version.rb

Defined Under Namespace

Classes: NotImplementedError

Constant Summary collapse

VERSION =
"0.0.3"

Instance Method Summary collapse

Instance Method Details

#errorsObject



29
30
31
# File 'lib/simple_command.rb', line 29

def errors
  @errors ||= {}
end

#failure?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/simple_command.rb', line 21

def failure?
  performed? && errors.any?
end

#performObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/simple_command.rb', line 6

def perform
  if !defined?(super)
    raise NotImplementedError
  end

  @performed = true
  @result = super

  self
end

#resultObject



25
26
27
# File 'lib/simple_command.rb', line 25

def result
  @result
end

#success?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/simple_command.rb', line 17

def success?
  performed? && !failure?
end