initialize

in lib/linguist/language.rb [221:269]


    def initialize(attributes = {})
      
      @name = attributes[:name] || raise(ArgumentError, "missing name")

      
      @type = attributes[:type] ? attributes[:type].to_sym : nil
      if @type && !TYPES.include?(@type)
        raise ArgumentError, "invalid type: #{@type}"
      end

      @color = attributes[:color]

      
      @aliases = [default_alias_name] + (attributes[:aliases] || [])

      @ace_mode = attributes[:ace_mode]
      @wrap = attributes[:wrap] || false

      
      @search_term = attributes[:search_term] || default_alias_name

      
      @extensions = attributes[:extensions] || []
      @filenames  = attributes[:filenames]  || []

      unless @primary_extension = attributes[:primary_extension]
        raise ArgumentError, "#{@name} is missing primary extension"
      end

      
      if primary_extension && !extensions.include?(primary_extension)
        @extensions = [primary_extension] + extensions
      end

      
      @popular    = attributes.key?(:popular)    ? attributes[:popular]    : false
      @searchable = attributes.key?(:searchable) ? attributes[:searchable] : true

      
      if attributes[:group_name]
        @group = nil
        @group_name = attributes[:group_name]

      
      else
        @group = self
      end
    end