Class: Slayer::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/slayer/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, status, message) ⇒ Result


5
6
7
8
9
# File 'lib/slayer/result.rb', line 5

def initialize(value, status, message)
  @value   = value
  @status  = status
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message


3
4
5
# File 'lib/slayer/result.rb', line 3

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status


3
4
5
# File 'lib/slayer/result.rb', line 3

def status
  @status
end

#valueObject (readonly)

Returns the value of attribute value


3
4
5
# File 'lib/slayer/result.rb', line 3

def value
  @value
end

Instance Method Details

#fail!Object


19
20
21
22
# File 'lib/slayer/result.rb', line 19

def fail!
  @failure = true
  raise CommandFailureError, self
end

#failure?Boolean


15
16
17
# File 'lib/slayer/result.rb', line 15

def failure?
  @failure || false
end

#success?Boolean


11
12
13
# File 'lib/slayer/result.rb', line 11

def success?
  !failure?
end