Class: Weblate::Unit
- Inherits:
-
Object
- Object
- Weblate::Unit
- Defined in:
- lib/weblate/models/unit.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#approved ⇒ Object
Returns the value of attribute approved.
-
#content_hash ⇒ Object
Returns the value of attribute content_hash.
-
#context ⇒ Object
Returns the value of attribute context.
-
#explanation ⇒ Object
Additional explanation to clarify meaning or usage of the string.
-
#extra_flags ⇒ Object
Additional comma-separated flags to influence Weblate behavior.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#fuzzy ⇒ Object
Returns the value of attribute fuzzy.
-
#has_comment ⇒ Object
Returns the value of attribute has_comment.
-
#has_failing_check ⇒ Object
Returns the value of attribute has_failing_check.
-
#has_suggestion ⇒ Object
Returns the value of attribute has_suggestion.
-
#id ⇒ Object
Returns the value of attribute id.
-
#id_hash ⇒ Object
Returns the value of attribute id_hash.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#last_updated ⇒ Object
Returns the value of attribute last_updated.
-
#location ⇒ Object
Returns the value of attribute location.
-
#note ⇒ Object
Returns the value of attribute note.
-
#num_words ⇒ Object
Returns the value of attribute num_words.
-
#pending ⇒ Object
Returns the value of attribute pending.
-
#position ⇒ Object
Returns the value of attribute position.
-
#previous_source ⇒ Object
Returns the value of attribute previous_source.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_unit ⇒ Object
Returns the value of attribute source_unit.
-
#state ⇒ Object
Returns the value of attribute state.
-
#target ⇒ Object
Returns the value of attribute target.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#translated ⇒ Object
Returns the value of attribute translated.
-
#translation ⇒ Object
Returns the value of attribute translation.
-
#url ⇒ Object
Returns the value of attribute url.
-
#web_url ⇒ Object
Returns the value of attribute web_url.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Unit
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Unit
Initializes the object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/weblate/models/unit.rb', line 187 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Weblate::Unit` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Weblate::Unit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'translation') self.translation = attributes[:'translation'] else self.translation = nil end if attributes.key?(:'source') if (value = attributes[:'source']).is_a?(Array) self.source = value end else self.source = nil end if attributes.key?(:'previous_source') self.previous_source = attributes[:'previous_source'] end if attributes.key?(:'target') if (value = attributes[:'target']).is_a?(Array) self.target = value end else self.target = nil end if attributes.key?(:'id_hash') self.id_hash = attributes[:'id_hash'] else self.id_hash = nil end if attributes.key?(:'content_hash') self.content_hash = attributes[:'content_hash'] else self.content_hash = nil end if attributes.key?(:'location') self.location = attributes[:'location'] end if attributes.key?(:'context') self.context = attributes[:'context'] end if attributes.key?(:'note') self.note = attributes[:'note'] end if attributes.key?(:'flags') self.flags = attributes[:'flags'] end if attributes.key?(:'labels') if (value = attributes[:'labels']).is_a?(Array) self.labels = value end else self.labels = nil end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'fuzzy') self.fuzzy = attributes[:'fuzzy'] else self.fuzzy = nil end if attributes.key?(:'translated') self.translated = attributes[:'translated'] else self.translated = nil end if attributes.key?(:'approved') self.approved = attributes[:'approved'] else self.approved = nil end if attributes.key?(:'position') self.position = attributes[:'position'] else self.position = nil end if attributes.key?(:'has_suggestion') self.has_suggestion = attributes[:'has_suggestion'] else self.has_suggestion = nil end if attributes.key?(:'has_comment') self.has_comment = attributes[:'has_comment'] else self.has_comment = nil end if attributes.key?(:'has_failing_check') self.has_failing_check = attributes[:'has_failing_check'] else self.has_failing_check = nil end if attributes.key?(:'num_words') self.num_words = attributes[:'num_words'] end if attributes.key?(:'source_unit') self.source_unit = attributes[:'source_unit'] else self.source_unit = nil end if attributes.key?(:'priority') self.priority = attributes[:'priority'] end if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'web_url') self.web_url = attributes[:'web_url'] else self.web_url = nil end if attributes.key?(:'url') self.url = attributes[:'url'] else self.url = nil end if attributes.key?(:'explanation') self.explanation = attributes[:'explanation'] end if attributes.key?(:'extra_flags') self.extra_flags = attributes[:'extra_flags'] end if attributes.key?(:'pending') self.pending = attributes[:'pending'] else self.pending = nil end if attributes.key?(:'timestamp') self. = attributes[:'timestamp'] else self. = nil end if attributes.key?(:'last_updated') self.last_updated = attributes[:'last_updated'] else self.last_updated = nil end end |
Instance Attribute Details
#approved ⇒ Object
Returns the value of attribute approved.
46 47 48 |
# File 'lib/weblate/models/unit.rb', line 46 def approved @approved end |
#content_hash ⇒ Object
Returns the value of attribute content_hash.
28 29 30 |
# File 'lib/weblate/models/unit.rb', line 28 def content_hash @content_hash end |
#context ⇒ Object
Returns the value of attribute context.
32 33 34 |
# File 'lib/weblate/models/unit.rb', line 32 def context @context end |
#explanation ⇒ Object
Additional explanation to clarify meaning or usage of the string.
69 70 71 |
# File 'lib/weblate/models/unit.rb', line 69 def explanation @explanation end |
#extra_flags ⇒ Object
Additional comma-separated flags to influence Weblate behavior.
72 73 74 |
# File 'lib/weblate/models/unit.rb', line 72 def extra_flags @extra_flags end |
#flags ⇒ Object
Returns the value of attribute flags.
36 37 38 |
# File 'lib/weblate/models/unit.rb', line 36 def flags @flags end |
#fuzzy ⇒ Object
Returns the value of attribute fuzzy.
42 43 44 |
# File 'lib/weblate/models/unit.rb', line 42 def fuzzy @fuzzy end |
#has_comment ⇒ Object
Returns the value of attribute has_comment.
52 53 54 |
# File 'lib/weblate/models/unit.rb', line 52 def has_comment @has_comment end |
#has_failing_check ⇒ Object
Returns the value of attribute has_failing_check.
54 55 56 |
# File 'lib/weblate/models/unit.rb', line 54 def has_failing_check @has_failing_check end |
#has_suggestion ⇒ Object
Returns the value of attribute has_suggestion.
50 51 52 |
# File 'lib/weblate/models/unit.rb', line 50 def has_suggestion @has_suggestion end |
#id ⇒ Object
Returns the value of attribute id.
62 63 64 |
# File 'lib/weblate/models/unit.rb', line 62 def id @id end |
#id_hash ⇒ Object
Returns the value of attribute id_hash.
26 27 28 |
# File 'lib/weblate/models/unit.rb', line 26 def id_hash @id_hash end |
#labels ⇒ Object
Returns the value of attribute labels.
38 39 40 |
# File 'lib/weblate/models/unit.rb', line 38 def labels @labels end |
#last_updated ⇒ Object
Returns the value of attribute last_updated.
78 79 80 |
# File 'lib/weblate/models/unit.rb', line 78 def last_updated @last_updated end |
#location ⇒ Object
Returns the value of attribute location.
30 31 32 |
# File 'lib/weblate/models/unit.rb', line 30 def location @location end |
#note ⇒ Object
Returns the value of attribute note.
34 35 36 |
# File 'lib/weblate/models/unit.rb', line 34 def note @note end |
#num_words ⇒ Object
Returns the value of attribute num_words.
56 57 58 |
# File 'lib/weblate/models/unit.rb', line 56 def num_words @num_words end |
#pending ⇒ Object
Returns the value of attribute pending.
74 75 76 |
# File 'lib/weblate/models/unit.rb', line 74 def pending @pending end |
#position ⇒ Object
Returns the value of attribute position.
48 49 50 |
# File 'lib/weblate/models/unit.rb', line 48 def position @position end |
#previous_source ⇒ Object
Returns the value of attribute previous_source.
22 23 24 |
# File 'lib/weblate/models/unit.rb', line 22 def previous_source @previous_source end |
#priority ⇒ Object
Returns the value of attribute priority.
60 61 62 |
# File 'lib/weblate/models/unit.rb', line 60 def priority @priority end |
#source ⇒ Object
Returns the value of attribute source.
20 21 22 |
# File 'lib/weblate/models/unit.rb', line 20 def source @source end |
#source_unit ⇒ Object
Returns the value of attribute source_unit.
58 59 60 |
# File 'lib/weblate/models/unit.rb', line 58 def source_unit @source_unit end |
#state ⇒ Object
Returns the value of attribute state.
40 41 42 |
# File 'lib/weblate/models/unit.rb', line 40 def state @state end |
#target ⇒ Object
Returns the value of attribute target.
24 25 26 |
# File 'lib/weblate/models/unit.rb', line 24 def target @target end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
76 77 78 |
# File 'lib/weblate/models/unit.rb', line 76 def @timestamp end |
#translated ⇒ Object
Returns the value of attribute translated.
44 45 46 |
# File 'lib/weblate/models/unit.rb', line 44 def translated @translated end |
#translation ⇒ Object
Returns the value of attribute translation.
18 19 20 |
# File 'lib/weblate/models/unit.rb', line 18 def translation @translation end |
#url ⇒ Object
Returns the value of attribute url.
66 67 68 |
# File 'lib/weblate/models/unit.rb', line 66 def url @url end |
#web_url ⇒ Object
Returns the value of attribute web_url.
64 65 66 |
# File 'lib/weblate/models/unit.rb', line 64 def web_url @web_url end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/weblate/models/unit.rb', line 670 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Weblate.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
139 140 141 |
# File 'lib/weblate/models/unit.rb', line 139 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/weblate/models/unit.rb', line 103 def self.attribute_map { :'translation' => :'translation', :'source' => :'source', :'previous_source' => :'previous_source', :'target' => :'target', :'id_hash' => :'id_hash', :'content_hash' => :'content_hash', :'location' => :'location', :'context' => :'context', :'note' => :'note', :'flags' => :'flags', :'labels' => :'labels', :'state' => :'state', :'fuzzy' => :'fuzzy', :'translated' => :'translated', :'approved' => :'approved', :'position' => :'position', :'has_suggestion' => :'has_suggestion', :'has_comment' => :'has_comment', :'has_failing_check' => :'has_failing_check', :'num_words' => :'num_words', :'source_unit' => :'source_unit', :'priority' => :'priority', :'id' => :'id', :'web_url' => :'web_url', :'url' => :'url', :'explanation' => :'explanation', :'extra_flags' => :'extra_flags', :'pending' => :'pending', :'timestamp' => :'timestamp', :'last_updated' => :'last_updated' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
# File 'lib/weblate/models/unit.rb', line 646 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
180 181 182 183 |
# File 'lib/weblate/models/unit.rb', line 180 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/weblate/models/unit.rb', line 144 def self.openapi_types { :'translation' => :'String', :'source' => :'Array<String>', :'previous_source' => :'String', :'target' => :'Array<String>', :'id_hash' => :'Integer', :'content_hash' => :'Integer', :'location' => :'String', :'context' => :'String', :'note' => :'String', :'flags' => :'String', :'labels' => :'Array<UnitLabels>', :'state' => :'StateEnum', :'fuzzy' => :'Boolean', :'translated' => :'Boolean', :'approved' => :'Boolean', :'position' => :'Integer', :'has_suggestion' => :'Boolean', :'has_comment' => :'Boolean', :'has_failing_check' => :'Boolean', :'num_words' => :'Integer', :'source_unit' => :'String', :'priority' => :'Integer', :'id' => :'Integer', :'web_url' => :'String', :'url' => :'String', :'explanation' => :'String', :'extra_flags' => :'String', :'pending' => :'Boolean', :'timestamp' => :'Time', :'last_updated' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 |
# File 'lib/weblate/models/unit.rb', line 596 def ==(o) return true if self.equal?(o) self.class == o.class && translation == o.translation && source == o.source && previous_source == o.previous_source && target == o.target && id_hash == o.id_hash && content_hash == o.content_hash && location == o.location && context == o.context && note == o.note && flags == o.flags && labels == o.labels && state == o.state && fuzzy == o.fuzzy && translated == o.translated && approved == o.approved && position == o.position && has_suggestion == o.has_suggestion && has_comment == o.has_comment && has_failing_check == o.has_failing_check && num_words == o.num_words && source_unit == o.source_unit && priority == o.priority && id == o.id && web_url == o.web_url && url == o.url && explanation == o.explanation && extra_flags == o.extra_flags && pending == o.pending && == o. && last_updated == o.last_updated end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
741 742 743 744 745 746 747 748 749 750 751 752 753 |
# File 'lib/weblate/models/unit.rb', line 741 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
633 634 635 |
# File 'lib/weblate/models/unit.rb', line 633 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
639 640 641 |
# File 'lib/weblate/models/unit.rb', line 639 def hash [translation, source, previous_source, target, id_hash, content_hash, location, context, note, flags, labels, state, fuzzy, translated, approved, position, has_suggestion, has_comment, has_failing_check, num_words, source_unit, priority, id, web_url, url, explanation, extra_flags, pending, , last_updated].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/weblate/models/unit.rb', line 369 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @translation.nil? invalid_properties.push('invalid value for "translation", translation cannot be nil.') end if @source.nil? invalid_properties.push('invalid value for "source", source cannot be nil.') end if @target.nil? invalid_properties.push('invalid value for "target", target cannot be nil.') end if @id_hash.nil? invalid_properties.push('invalid value for "id_hash", id_hash cannot be nil.') end if @id_hash > 9223372036854775807 invalid_properties.push('invalid value for "id_hash", must be smaller than or equal to 9223372036854775807.') end if @id_hash < -9223372036854775808 invalid_properties.push('invalid value for "id_hash", must be greater than or equal to -9223372036854775808.') end if @content_hash.nil? invalid_properties.push('invalid value for "content_hash", content_hash cannot be nil.') end if @labels.nil? invalid_properties.push('invalid value for "labels", labels cannot be nil.') end if @fuzzy.nil? invalid_properties.push('invalid value for "fuzzy", fuzzy cannot be nil.') end if @translated.nil? invalid_properties.push('invalid value for "translated", translated cannot be nil.') end if @approved.nil? invalid_properties.push('invalid value for "approved", approved cannot be nil.') end if @position.nil? invalid_properties.push('invalid value for "position", position cannot be nil.') end if @position > 2147483647 invalid_properties.push('invalid value for "position", must be smaller than or equal to 2147483647.') end if @position < -2147483648 invalid_properties.push('invalid value for "position", must be greater than or equal to -2147483648.') end if @has_suggestion.nil? invalid_properties.push('invalid value for "has_suggestion", has_suggestion cannot be nil.') end if @has_comment.nil? invalid_properties.push('invalid value for "has_comment", has_comment cannot be nil.') end if @has_failing_check.nil? invalid_properties.push('invalid value for "has_failing_check", has_failing_check cannot be nil.') end if !@num_words.nil? && @num_words > 2147483647 invalid_properties.push('invalid value for "num_words", must be smaller than or equal to 2147483647.') end if !@num_words.nil? && @num_words < -2147483648 invalid_properties.push('invalid value for "num_words", must be greater than or equal to -2147483648.') end if @source_unit.nil? invalid_properties.push('invalid value for "source_unit", source_unit cannot be nil.') end if !@priority.nil? && @priority > 2147483647 invalid_properties.push('invalid value for "priority", must be smaller than or equal to 2147483647.') end if !@priority.nil? && @priority < -2147483648 invalid_properties.push('invalid value for "priority", must be greater than or equal to -2147483648.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @web_url.nil? invalid_properties.push('invalid value for "web_url", web_url cannot be nil.') end if @url.nil? invalid_properties.push('invalid value for "url", url cannot be nil.') end if @pending.nil? invalid_properties.push('invalid value for "pending", pending cannot be nil.') end if @timestamp.nil? invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.') end if @last_updated.nil? invalid_properties.push('invalid value for "last_updated", last_updated cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
717 718 719 |
# File 'lib/weblate/models/unit.rb', line 717 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
723 724 725 726 727 728 729 730 731 732 733 734 735 |
# File 'lib/weblate/models/unit.rb', line 723 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
711 712 713 |
# File 'lib/weblate/models/unit.rb', line 711 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/weblate/models/unit.rb', line 489 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @translation.nil? return false if @source.nil? return false if @target.nil? return false if @id_hash.nil? return false if @id_hash > 9223372036854775807 return false if @id_hash < -9223372036854775808 return false if @content_hash.nil? return false if @labels.nil? return false if @fuzzy.nil? return false if @translated.nil? return false if @approved.nil? return false if @position.nil? return false if @position > 2147483647 return false if @position < -2147483648 return false if @has_suggestion.nil? return false if @has_comment.nil? return false if @has_failing_check.nil? return false if !@num_words.nil? && @num_words > 2147483647 return false if !@num_words.nil? && @num_words < -2147483648 return false if @source_unit.nil? return false if !@priority.nil? && @priority > 2147483647 return false if !@priority.nil? && @priority < -2147483648 return false if @id.nil? return false if @web_url.nil? return false if @url.nil? return false if @pending.nil? return false if @timestamp.nil? return false if @last_updated.nil? true end |