class Cwsrb::Language

The Language class represents a language of ConWorkShop.

Attributes

code[R]

@return [String] The three-character language code.

ipa[R]

@return [String] The IPA transcription for the language's {@link native_name}

karma[R]

@return [Array<(Integer, Integer)>] The language's karma counts;

first one is upvotes and second one is downvotes.
name[R]

@return [String] The language's name.

native_name[R]

@return [String] The language's autonym (native name).

overview[R]

@return [String] The overview, about section or bio, of this language.

owners[R]

@return [Array<String>] The owner plus shared users of this language.

The first element is the original owner.
public[R]

@return [Boolean] Whether or not this language's dictionary is public.

registered[R]

@return [Time] The time at which the language was registered.

status[R]

@return [Language::Status] The language's status.

type[R]

@return [Language::Type] The language's type.

word_count[R]

@return [Integer] The word count for this language.

Public Class Methods

new(code: '', name: '', native_name: '', ipa: '', type: nil, owners: [], overview: '', public: true, status: '', registered: Time.now, word_count: 0, karma: [0, 0]) click to toggle source

Initializes a new Language instance with an options hash. @param code [String] The three-character language code. Defaults to an

empty string.

@param name [String] The language's name. Defaults to an empty string. @param native_name [String] The language's autonym (native name).

Defaults to an empty string.

@param ipa [String] The IPA transcription for the autonym. Defaults to

an empty string.

@param type [Type] The language's type. Defaults to `nil`. @param owners [Array<String>] The owner plus shared users of this

language. The first element must be the original owner.

@param overview [String] The overview, about me section, or bio, of

this language. Defaults to an empty string.

@param public [Boolean] Whether or not this language's dictionary is

public. Defaults to `true`.

@param status [Status] The language's status. Defaults to `nil`. @param registered [Time] When the language was registered. Defaults to

the current time.

@param word_count [Integer] The amount of words this language has.

Defaults to `0`.

@param karma [Array<(Integer, Integer)>] The language's karma counts.

The first is upvotes, the second is downvotes. Defaults to zero for
both.

@return [Language] The new Language instance.

# File lib/cwsrb/data.rb, line 178
def initialize(code: '', name: '', native_name: '', ipa: '', type: nil,
               owners: [], overview: '', public: true, status: '',
               registered: Time.now, word_count: 0, karma: [0, 0])
  @code = code
  @name = name
  @native_name = native_name
  @ipa = ipa
  @type = type
  @owners = owners
  @overview = overview
  @public = public
  @status = status
  @registered = registered
  @word_count = word_count
  @karma = karma
end

Public Instance Methods

inspect() click to toggle source

@overload inspect

@return [String] A more meaningful output than that of the default
inspect method, with all of Language's attributes.
# File lib/cwsrb/data.rb, line 204
def inspect
  "<Language code=#{@code} name=#{@name} native_name=#{@native_name} " \
    "ipa=#{@ipa} type=#{@type} owners=#{@owners} overview=#{@overview} " \
    "public=#{@public} status=#{@status} registered=#{@registered} " \
    "word_count=#{@word_count} karma=#{@karma}>"
end