Sha256: 22b2d0e7027b219ab0a7aef340e6e45d3eec166814627a4efa9151a70eaaff7d

Contents?: true

Size: 731 Bytes

Versions: 2

Compression:

Stored size: 731 Bytes

Contents

module SoberSwag
  module Reporting
    module Report
      ##
      # Report for a single value.
      # Basically a wrapper around an array of strings.
      class Value < Base
        ##
        # @param problems [Array<String>] problems with it
        def initialize(problems)
          raise ArgumentError, "#{problems} was not an enum" unless problems.respond_to?(:each)

          @problems = problems
        end

        ##
        # @return [Array<String>] the problems the value had
        attr_reader :problems

        def each_error
          return enum_for(:each_error) unless block_given?

          problems.each do |problem|
            yield nil, problem
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sober_swag-0.25.2 lib/sober_swag/reporting/report/value.rb
sober_swag-0.25.1 lib/sober_swag/reporting/report/value.rb