Sha256: 636986e3eb6f52e949ca128927bd0c33e42f72e53f58e2b0dc2f05c9a3e81200

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true
module AffairsOfState
  class Config
    attr_reader :statuses, :column, :allow_blank, :scopes, :if

    DISALLOWED_STATUSES = [ "new" ].freeze

    def initialize(statuses:, column:, allow_blank:, scopes:, if:)
      @column = column
      @allow_blank = !!allow_blank
      @scopes = !!scopes
      @if = binding.local_variable_get(:if)
      @statuses = statuses.flatten.map(&:to_s)
      @statuses.each do |status|
        raise ArgumentError.new("Affairs of State: '#{ status }' is not a valid status") if DISALLOWED_STATUSES.include?(status)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
affairs_of_state-0.7.0 lib/affairs_of_state/config.rb