Class: ActsAsCalculator::ImportOutcome

Inherits:
Data
  • Object
show all
Defined in:
lib/acts_as_calculator/import_outcome.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail

Returns:

  • (Object)

    the current value of detail



7
8
9
# File 'lib/acts_as_calculator/import_outcome.rb', line 7

def detail
  @detail
end

#keyObject (readonly)

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



7
8
9
# File 'lib/acts_as_calculator/import_outcome.rb', line 7

def key
  @key
end

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



7
8
9
# File 'lib/acts_as_calculator/import_outcome.rb', line 7

def kind
  @kind
end

#scopeObject (readonly)

Returns the value of attribute scope

Returns:

  • (Object)

    the current value of scope



7
8
9
# File 'lib/acts_as_calculator/import_outcome.rb', line 7

def scope
  @scope
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



7
8
9
# File 'lib/acts_as_calculator/import_outcome.rb', line 7

def status
  @status
end

Class Method Details

.build(kind:, status:, key:, scope:, detail: nil) ⇒ Object



8
9
10
# File 'lib/acts_as_calculator/import_outcome.rb', line 8

def self.build(kind:, status:, key:, scope:, detail: nil)
  new(kind: kind.to_sym, status: status.to_sym, key: key.to_s, scope: scope.to_s, detail:)
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/acts_as_calculator/import_outcome.rb', line 12

def failed?
  status == :failed
end

#to_sObject



16
17
18
# File 'lib/acts_as_calculator/import_outcome.rb', line 16

def to_s
  "#{status} #{kind} #{key.inspect} (scope #{scope.inspect})#{detail && "#{detail}"}"
end