Class: Seams::Generators::Splicer::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/seams/generators/splicer.rb

Overview

Result struct returned by every splice operation. ‘ok?` is the only required predicate; `error` is populated only when ok? is false; `lines_added` is 0 when ok? is true but the splice was a no-op (idempotency hit).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



55
56
57
# File 'lib/seams/generators/splicer.rb', line 55

def error
  @error
end

#lines_addedObject

Returns the value of attribute lines_added

Returns:

  • (Object)

    the current value of lines_added



55
56
57
# File 'lib/seams/generators/splicer.rb', line 55

def lines_added
  @lines_added
end

#ok?Object

Returns the value of attribute ok?

Returns:

  • (Object)

    the current value of ok?



55
56
57
# File 'lib/seams/generators/splicer.rb', line 55

def ok?
  @ok?
end

Instance Method Details

#to_sObject



56
57
58
# File 'lib/seams/generators/splicer.rb', line 56

def to_s
  ok? ? "Splicer::Result(ok, +#{lines_added})" : "Splicer::Result(error: #{error})"
end