Class: Cwsrb::Language
- Inherits:
-
Object
- Object
- Cwsrb::Language
- Defined in:
- lib/cwsrb/data.rb
Overview
The Language class represents a language of ConWorkShop.
Defined Under Namespace
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
The three-character language code.
-
#ipa ⇒ String
readonly
The IPA transcription for the language's native_name.
-
#karma ⇒ Array<(Integer, Integer)>
readonly
The language's karma counts; first one is upvotes and second one is downvotes.
-
#name ⇒ String
readonly
The language's name.
-
#native_name ⇒ String
readonly
The language's autonym (native name).
-
#overview ⇒ String
readonly
The overview, about section or bio, of this language.
-
#owners ⇒ Array<String>
readonly
The owner plus shared users of this language.
-
#public ⇒ Boolean
readonly
Whether or not this language's dictionary is public.
-
#registered ⇒ Time
readonly
The time at which the language was registered.
-
#status ⇒ Language::Status
readonly
The language's status.
-
#type ⇒ Language::Type
readonly
The language's type.
-
#word_count ⇒ Integer
readonly
The word count for this language.
Instance Method Summary collapse
-
#generate_link ⇒ String
Generates a CWS link to this language.
-
#initialize(code: '', name: '', native_name: '', ipa: '', type: nil, owners: [], overview: '', public: true, status: '', registered: Time.now, word_count: 0, karma: [0, 0]) ⇒ Language
constructor
Initializes a new Language instance with an options hash.
-
#inspect ⇒ String
inspect method, with all of Language's attributes.
Constructor Details
#initialize(code: '', name: '', native_name: '', ipa: '', type: nil, owners: [], overview: '', public: true, status: '', registered: Time.now, word_count: 0, karma: [0, 0]) ⇒ Language
Initializes a new Language instance with an options hash.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# 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 |
Instance Attribute Details
#code ⇒ String (readonly)
Returns The three-character language code.
117 118 119 |
# File 'lib/cwsrb/data.rb', line 117 def code @code end |
#ipa ⇒ String (readonly)
Returns The IPA transcription for the language's native_name.
126 127 128 |
# File 'lib/cwsrb/data.rb', line 126 def ipa @ipa end |
#karma ⇒ Array<(Integer, Integer)> (readonly)
Returns The language's karma counts; first one is upvotes and second one is downvotes.
152 153 154 |
# File 'lib/cwsrb/data.rb', line 152 def karma @karma end |
#name ⇒ String (readonly)
Returns The language's name.
120 121 122 |
# File 'lib/cwsrb/data.rb', line 120 def name @name end |
#native_name ⇒ String (readonly)
Returns The language's autonym (native name).
123 124 125 |
# File 'lib/cwsrb/data.rb', line 123 def native_name @native_name end |
#overview ⇒ String (readonly)
Returns The overview, about section or bio, of this language.
136 137 138 |
# File 'lib/cwsrb/data.rb', line 136 def overview @overview end |
#owners ⇒ Array<String> (readonly)
Returns The owner plus shared users of this language. The first element is the original owner.
133 134 135 |
# File 'lib/cwsrb/data.rb', line 133 def owners @owners end |
#public ⇒ Boolean (readonly)
Returns Whether or not this language's dictionary is public.
139 140 141 |
# File 'lib/cwsrb/data.rb', line 139 def public @public end |
#registered ⇒ Time (readonly)
Returns The time at which the language was registered.
145 146 147 |
# File 'lib/cwsrb/data.rb', line 145 def registered @registered end |
#status ⇒ Language::Status (readonly)
Returns The language's status.
142 143 144 |
# File 'lib/cwsrb/data.rb', line 142 def status @status end |
#type ⇒ Language::Type (readonly)
Returns The language's type.
129 130 131 |
# File 'lib/cwsrb/data.rb', line 129 def type @type end |
#word_count ⇒ Integer (readonly)
Returns The word count for this language.
148 149 150 |
# File 'lib/cwsrb/data.rb', line 148 def word_count @word_count end |
Instance Method Details
#generate_link ⇒ String
Generates a CWS link to this language.
197 198 199 |
# File 'lib/cwsrb/data.rb', line 197 def generate_link CWS_BASE + "/view_language.php?l=#{@code}" end |
#inspect ⇒ String
204 205 206 207 208 209 |
# 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 |