<commit_before>module PricingDefinition
  module Behaviours
    module Priceable
      module SetupMethods

        ALLOWED_OPTION_KEYS = [:primary, :addon, :for, :minimum, :maximum, :currency]

        def priceable(options = {})
          @options = options
          setup_association
          setup_config!
        end

        private

        attr_reader :options

        def setup_association
          has_many :pricing_definitions, -> { order("pricing_definitions.weight DESC") },
            as: :priceable,
            class_name: 'PricingDefinition::Resources::Definition',
            dependent: :destroy
        end

        def setup_config!
          validate_options!<commit_msg>Priceable models now accept nested attributes for piricing definition<commit_after>module PricingDefinition
  module Behaviours
    module Priceable
      module SetupMethods

        ALLOWED_OPTION_KEYS = [:primary, :addon, :for, :minimum, :maximum, :currency]

        def priceable(options = {})
          @options = options
          setup_association
          setup_config!
        end

        private

        attr_reader :options

        def setup_association
          has_many :pricing_definitions, -> { order("pricing_definitions.weight DESC") },
            as: :priceable,
            class_name: 'PricingDefinition::Resources::Definition',
            dependent: :destroy
          accepts_nested_attributes_for :pricing_definitions
        end

        def setup_config!
          validate_options!
{'fraction_non_alphanumeric': 0.07072042300066093, 'fraction_numerical': 0.0, 'mean_word_length': 2.3274725274725276, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2140877', 'n_tokens_mistral': 404, 'n_tokens_neox': 392, 'n_words': 91}