class LinguistsFieldGuide::Language

Language names that are recognizable by GitHub.

This is a trimmed-down version of [`github-linguist`'s](rubygems.org/gems/github-linguist) [`Linguist::Language`](www.rubydoc.info/gems/github-linguist/Linguist/Language) class, with just enough information to use for reference.

Attributes

ace_mode[R]

See [github-linguist's documentation of `ace_mode`](www.rubydoc.info/gems/github-linguist/Linguist/Language#ace_mode-instance_method)

aliases[R]

See [github-linguist's documentation of `aliases`](www.rubydoc.info/gems/github-linguist/Linguist/Language#aliases-instance_method)

codemirror_mime_type[R]

See [github-linguist's documentation of `codemirror_mime_type`](www.rubydoc.info/gems/github-linguist/Linguist/Language#codemirror_mime_type-instance_method)

codemirror_mode[R]

See [github-linguist's documentation of `codemirror_mode`](www.rubydoc.info/gems/github-linguist/Linguist/Language#codemirror_mode-instance_method)

color[R]

See [github-linguist's documentation of `color`](www.rubydoc.info/gems/github-linguist/Linguist/Language#color-instance_method)

extensions[R]

See [github-linguist's documentation of `extensions`](www.rubydoc.info/gems/github-linguist/Linguist/Language#extensions-instance_method)

filenames[R]

See [github-linguist's documentation of `filenames`](www.rubydoc.info/gems/github-linguist/Linguist/Language#filenames-instance_method)

fs_name[R]

See [github-linguist's documentation of `fs_name`](www.rubydoc.info/gems/github-linguist/Linguist/Language#fs_name-instance_method)

interpreters[R]

See [github-linguist's documentation of `interpreters`](www.rubydoc.info/gems/github-linguist/Linguist/Language#interpreters-instance_method)

language_id[R]

See [github-linguist's documentation of `language_id`](www.rubydoc.info/gems/github-linguist/Linguist/Language#language_id-instance_method)

name[R]

See [github-linguist's documentation of `name`](www.rubydoc.info/gems/github-linguist/Linguist/Language#name-instance_method)

tm_scope[R]

See [github-linguist's documentation of `tm_scope`](www.rubydoc.info/gems/github-linguist/Linguist/Language#tm_scope-instance_method)

wrap[R]

See [github-linguist's documentation of `wrap`](www.rubydoc.info/gems/github-linguist/Linguist/Language#wrap-instance_method)

Public Class Methods

all() click to toggle source

@return [Array<Language>]

# File lib/linguists_field_guide.rb, line 66
def self.all
  @languages
end
create(attributes) click to toggle source

Internal: Creates a Language object, applies all the given attributes to instance variables, and adds it to the `#all` list. @private

# File lib/linguists_field_guide.rb, line 49
def self.create(attributes)
  language = new(attributes)

  @languages << language

  @index[language.name.downcase] = @name_index[language.name.downcase] = language
end
find_by_name(name) click to toggle source

Look up Language by its proper name.

@param [String] name The proper name of a Language

# File lib/linguists_field_guide.rb, line 73
def self.find_by_name(name)
  @name_index[name&.downcase]
end
new(attributes) click to toggle source

Internal: Applies all the given attributes to instance variables. @private

# File lib/linguists_field_guide.rb, line 59
def initialize(attributes)
  attributes.each do |key, value|
    instance_variable_set(key, value)
  end
end

Public Instance Methods

group() click to toggle source

Get Language group

@return [Language] The Language group

# File lib/linguists_field_guide.rb, line 80
def group
  @group ||= if @group_name.nil?
               self
             else
               Language.find_by_name(@group_name)
             end
end
searchable?() click to toggle source

Is it searchable?

# File lib/linguists_field_guide.rb, line 102
def searchable?
  @searchable
end
type() click to toggle source

Get type.

@return [Symbol] One of the defined

[`Linguist::Language::TYPES`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#TYPES-constant)
# File lib/linguists_field_guide.rb, line 92
def type
  @type.to_sym
end