<commit_before>class Module
  def bool_attr_reader(*attrs)
    attrs.each do |attr|
      define_method :"#{attr}?" do
        instance_variable_get(:"@#{attr}") || false
      end
    end
  end
end

module Representable
  class ContradictoryNamespaces < StandardError
  end
  class Definition # :nodoc:
    attr_reader :name, :sought_type, :wrapper, :accessor, :namespace
    bool_attr_reader :name_explicit, :array, :cdata
    
    def initialize(sym, opts={})
      @accessor   = sym.to_s
      @namespace  = opts.delete(:namespace)
      
      
      if opts[:as].is_a?(Array) # DISCUSS: move to ArrayDefinition.
        @array      = true
        @name       = (opts[:tag] || @accessor).to_s
      else
        @name = accessor
        @name = (opts[:from] || @name).to_s
      end

      @sought_type = extract_type(opts[:as])
      if @sought_type.respond_to?(:roxml_tag_name)
        opts[:from] ||= @sought_type.roxml_tag_name
      end

      if opts[:from] == :content
        opts[:from] = '.'
      elsif opts[:from] == :name
        opts[:from] = '*'
      elsif opts[:from] == :attr
        @sought_type = :attr
        opts[:from] = nil
      elsif opts[:from] == :namespace
        opts[:from] = '*'
        @sought_type = :namespace
      elsif opts[:from].to_s =~ /^@/  # FIXME: move me to xml.
        @sought_type = :attr
        opts[:from].sub!('@', '')
      end

      
      #raise ContradictoryNamespaces if @name.include?(':') && (@namespace.present? || @namespace == false)

    end

    def instance_variable_name
      :"@#{accessor}"
    end

    def setter
      :"#{accessor}="
    end
    
    def typed?
      sought_type.is_a?(Class)
    end
    
    def name?
      @name == '*'
    end

    def content?
      @name == '.'
    end
    
    # Applies the block to +value+ which might also be a collection.
    def apply(value)
      return value unless value # DISCUSS: is that ok here?
      <commit_msg>removing ContraditoryNamespace.<commit_after>class Module
  def bool_attr_reader(*attrs)
    attrs.each do |attr|
      define_method :"#{attr}?" do
        instance_variable_get(:"@#{attr}") || false
      end
    end
  end
end

module Representable
  class Definition # :nodoc:
    attr_reader :name, :sought_type, :wrapper, :accessor, :namespace
    bool_attr_reader :name_explicit, :array, :cdata
    
    def initialize(sym, opts={})
      @accessor   = sym.to_s
      @namespace  = opts.delete(:namespace)
      
      
      if opts[:as].is_a?(Array) # DISCUSS: move to ArrayDefinition.
        @array      = true
        @name       = (opts[:tag] || @accessor).to_s
      else
        @name = accessor
        @name = (opts[:from] || @name).to_s
      end

      @sought_type = extract_type(opts[:as])
      if @sought_type.respond_to?(:roxml_tag_name)
        opts[:from] ||= @sought_type.roxml_tag_name
      end

      if opts[:from] == :content
        opts[:from] = '.'
      elsif opts[:from] == :name
        opts[:from] = '*'
      elsif opts[:from] == :attr
        @sought_type = :attr
        opts[:from] = nil
      elsif opts[:from] == :namespace
        opts[:from] = '*'
        @sought_type = :namespace
      elsif opts[:from].to_s =~ /^@/  # FIXME: move me to xml.
        @sought_type = :attr
        opts[:from].sub!('@', '')
      end
    end

    def instance_variable_name
      :"@#{accessor}"
    end

    def setter
      :"#{accessor}="
    end
    
    def typed?
      sought_type.is_a?(Class)
    end
    
    def name?
      @name == '*'
    end

    def content?
      @name == '.'
    end
    
    # Applies the block to +value+ which might also be a collection.
    def apply(value)
      return value unless value # DISCUSS: is that ok here?
      
{'fraction_non_alphanumeric': 0.1357429718875502, 'fraction_numerical': 0.0, 'mean_word_length': 2.136859781696054, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '1859110', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1245, 'n_words': 288}