Sha256: bdf03b2b94b51f415cf5cf3b1db80c7776ae8af4c5a698c698acc54deacd6287

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

module ActiveFields
  class CustomizableConfig
    attr_reader :customizable_model, :types

    def initialize(customizable_model)
      @customizable_model = customizable_model
    end

    def types=(value)
      invalid_types = value - ActiveFields.config.fields.keys
      if invalid_types.any?
        raise ArgumentError, "undefined ActiveFields types provided for #{customizable_model}: #{invalid_types}"
      end

      @types = value
    end

    def types_class_names
      ActiveFields.config.fields.values_at(*types)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_fields-0.2.0 lib/active_fields/customizable_config.rb