Class: BomDB::Import::Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success:, error: nil) ⇒ Result

Returns a new instance of Result.



6
7
8
9
# File 'lib/bomdb/import/result.rb', line 6

def initialize(success:, error: nil)
  @success = success
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



4
5
6
# File 'lib/bomdb/import/result.rb', line 4

def error
  @error
end

#successObject (readonly)

Returns the value of attribute success.



4
5
6
# File 'lib/bomdb/import/result.rb', line 4

def success
  @success
end

Instance Method Details

#messageObject



15
16
17
18
19
20
21
# File 'lib/bomdb/import/result.rb', line 15

def message
  if @success
    "Succeeded"
  else
    @error.to_s
  end
end

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  @success
end