class Cwsrb::Language
The Language
class represents a language of ConWorkShop.
Attributes
@return [String] The three-character language code.
@return [String] The IPA transcription for the language's {@link native_name
}
@return [Array<(Integer, Integer)>] The language's karma counts;
first one is upvotes and second one is downvotes.
@return [String] The language's name.
@return [String] The language's autonym (native name).
@return [String] The overview, about section or bio, of this language.
@return [Array<String>] The owner plus shared users of this language.
The first element is the original owner.
@return [Boolean] Whether or not this language's dictionary is public.
@return [Time] The time at which the language was registered.
@return [Language::Status] The language's status.
@return [Language::Type] The language's type.
@return [Integer] The word count for this language.
Public Class Methods
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
Generates a CWS link to this language. @return [String] The generated link.
# File lib/cwsrb/data.rb, line 197 def generate_link CWS_BASE + "/view_language.php?l=#{@code}" end
@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