Class: ArticleTechnical::Consolidator::Result

Inherits:
Data
  • Object
show all
Defined in:
app/services/article_technical/consolidator.rb

Overview

Immutable outcome of a consolidation attempt.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success:, article: nil, errors: []) ⇒ Result

Creates a normalized result.

Parameters:

  • success (Boolean)

    whether a draft was created

  • article (ArticleTechnical, nil) (defaults to: nil)

    resulting consolidation draft

  • errors (Array<String>) (defaults to: [])

    validation or persistence errors



30
31
32
# File 'app/services/article_technical/consolidator.rb', line 30

def initialize(success:, article: nil, errors: [])
  super
end

Instance Attribute Details

#articleObject (readonly)

Returns the value of attribute article

Returns:

  • (Object)

    the current value of article



24
25
26
# File 'app/services/article_technical/consolidator.rb', line 24

def article
  @article
end

#errorsObject (readonly)

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



24
25
26
# File 'app/services/article_technical/consolidator.rb', line 24

def errors
  @errors
end

#successObject (readonly)

Returns the value of attribute success

Returns:

  • (Object)

    the current value of success



24
25
26
# File 'app/services/article_technical/consolidator.rb', line 24

def success
  @success
end

Instance Method Details

#success?Boolean

Returns whether a draft was created.

Returns:

  • (Boolean)

    whether a draft was created



35
# File 'app/services/article_technical/consolidator.rb', line 35

def success? = success == true