Class: AsposeWordsCloud::ListLevel

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_words_cloud/models/list_level.rb

Overview

Represents a document list levels.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ListLevel

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



137
138
139
140
141
142
143
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/aspose_words_cloud/models/list_level.rb', line 137

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.key?(:'Link')
    self.link = attributes[:'Link']
  end

  if attributes.key?(:'Alignment')
    self.alignment = attributes[:'Alignment']
  end

  if attributes.key?(:'Font')
    self.font = attributes[:'Font']
  end

  if attributes.key?(:'IsLegal')
    self.is_legal = attributes[:'IsLegal']
  end

  if attributes.key?(:'LinkedStyle')
    self.linked_style = attributes[:'LinkedStyle']
  end

  if attributes.key?(:'NumberFormat')
    self.number_format = attributes[:'NumberFormat']
  end

  if attributes.key?(:'NumberPosition')
    self.number_position = attributes[:'NumberPosition']
  end

  if attributes.key?(:'NumberStyle')
    self.number_style = attributes[:'NumberStyle']
  end

  if attributes.key?(:'RestartAfterLevel')
    self.restart_after_level = attributes[:'RestartAfterLevel']
  end

  if attributes.key?(:'StartAt')
    self.start_at = attributes[:'StartAt']
  end

  if attributes.key?(:'TabPosition')
    self.tab_position = attributes[:'TabPosition']
  end

  if attributes.key?(:'TextPosition')
    self.text_position = attributes[:'TextPosition']
  end

  if attributes.key?(:'TrailingCharacter')
    self.trailing_character = attributes[:'TrailingCharacter']
  end
end

Instance Attribute Details

#alignmentObject

Gets or sets the justification of the actual number of the list item.



36
37
38
# File 'lib/aspose_words_cloud/models/list_level.rb', line 36

def alignment
  @alignment
end

#fontObject

Gets or sets specifies character formatting used for the list label.



39
40
41
# File 'lib/aspose_words_cloud/models/list_level.rb', line 39

def font
  @font
end

Gets or sets a value indicating whether true if the level turns all inherited numbers to Arabic, false if it preserves their number style.



43
44
45
# File 'lib/aspose_words_cloud/models/list_level.rb', line 43

def is_legal
  @is_legal
end

Gets or sets link to the document.



33
34
35
# File 'lib/aspose_words_cloud/models/list_level.rb', line 33

def link
  @link
end

#linked_styleObject

Gets or sets the paragraph style that is linked to this list level.



46
47
48
# File 'lib/aspose_words_cloud/models/list_level.rb', line 46

def linked_style
  @linked_style
end

#number_formatObject

Gets or sets returns or sets the number format for the list level.



49
50
51
# File 'lib/aspose_words_cloud/models/list_level.rb', line 49

def number_format
  @number_format
end

#number_positionObject

Gets or sets returns or sets the position (in points) of the number or bullet for the list level.



53
54
55
# File 'lib/aspose_words_cloud/models/list_level.rb', line 53

def number_position
  @number_position
end

#number_styleObject

Gets or sets returns or sets the number style for this list level.



56
57
58
# File 'lib/aspose_words_cloud/models/list_level.rb', line 56

def number_style
  @number_style
end

#restart_after_levelObject

Gets or sets or returns the list level that must appear before the specified list level restarts numbering.



60
61
62
# File 'lib/aspose_words_cloud/models/list_level.rb', line 60

def restart_after_level
  @restart_after_level
end

#start_atObject

Gets or sets returns or sets the starting number for this list level.



63
64
65
# File 'lib/aspose_words_cloud/models/list_level.rb', line 63

def start_at
  @start_at
end

#tab_positionObject

Gets or sets returns or sets the tab position (in points) for the list level.



66
67
68
# File 'lib/aspose_words_cloud/models/list_level.rb', line 66

def tab_position
  @tab_position
end

#text_positionObject

Gets or sets returns or sets the position (in points) for the second line of wrapping text for the list level.



70
71
72
# File 'lib/aspose_words_cloud/models/list_level.rb', line 70

def text_position
  @text_position
end

#trailing_characterObject

Gets or sets returns or sets the character inserted after the number for the list level.



73
74
75
# File 'lib/aspose_words_cloud/models/list_level.rb', line 73

def trailing_character
  @trailing_character
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/aspose_words_cloud/models/list_level.rb', line 98

def self.attribute_map
  {
    :'link' => :'Link',
    :'alignment' => :'Alignment',
    :'font' => :'Font',
    :'is_legal' => :'IsLegal',
    :'linked_style' => :'LinkedStyle',
    :'number_format' => :'NumberFormat',
    :'number_position' => :'NumberPosition',
    :'number_style' => :'NumberStyle',
    :'restart_after_level' => :'RestartAfterLevel',
    :'start_at' => :'StartAt',
    :'tab_position' => :'TabPosition',
    :'text_position' => :'TextPosition',
    :'trailing_character' => :'TrailingCharacter'
  }
end

.swagger_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/aspose_words_cloud/models/list_level.rb', line 117

def self.swagger_types
  {
    :'link' => :'WordsApiLink',
    :'alignment' => :'String',
    :'font' => :'Font',
    :'is_legal' => :'BOOLEAN',
    :'linked_style' => :'Style',
    :'number_format' => :'String',
    :'number_position' => :'Float',
    :'number_style' => :'String',
    :'restart_after_level' => :'Integer',
    :'start_at' => :'Integer',
    :'tab_position' => :'Float',
    :'text_position' => :'Float',
    :'trailing_character' => :'String'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/aspose_words_cloud/models/list_level.rb', line 261

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
      link == other.link &&
      alignment == other.alignment &&
      font == other.font &&
      is_legal == other.is_legal &&
      linked_style == other.linked_style &&
      number_format == other.number_format &&
      number_position == other.number_position &&
      number_style == other.number_style &&
      restart_after_level == other.restart_after_level &&
      start_at == other.start_at &&
      tab_position == other.tab_position &&
      text_position == other.text_position &&
      trailing_character == other.trailing_character
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



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
# File 'lib/aspose_words_cloud/models/list_level.rb', line 316

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    Time.at(/\d/.match(value)[0].to_f).to_datetime
  when :Date
    Time.at(/\d/.match(value)[0].to_f).to_date
  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
    temp_model = AsposeWordsCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/aspose_words_cloud/models/list_level.rb', line 383

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

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/aspose_words_cloud/models/list_level.rb', line 294

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


281
282
283
# File 'lib/aspose_words_cloud/models/list_level.rb', line 281

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



287
288
289
# File 'lib/aspose_words_cloud/models/list_level.rb', line 287

def hash
  [link, alignment, font, is_legal, linked_style, number_format, number_position, number_style, restart_after_level, start_at, tab_position, text_position, trailing_character].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



198
199
200
201
# File 'lib/aspose_words_cloud/models/list_level.rb', line 198

def list_invalid_properties
  invalid_properties = []
  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



363
364
365
# File 'lib/aspose_words_cloud/models/list_level.rb', line 363

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



369
370
371
372
373
374
375
376
377
# File 'lib/aspose_words_cloud/models/list_level.rb', line 369

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



357
358
359
# File 'lib/aspose_words_cloud/models/list_level.rb', line 357

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



205
206
207
208
209
210
211
212
213
214
# File 'lib/aspose_words_cloud/models/list_level.rb', line 205

def valid?
  alignment_validator = EnumAttributeValidator.new('String', ["Left", "Center", "Right"])
  return false unless alignment_validator.valid?(@alignment)
  number_style_validator = EnumAttributeValidator.new('String', ["Arabic", "UppercaseRoman", "LowercaseRoman", "UppercaseLetter", "LowercaseLetter", "Ordinal", "Number", "OrdinalText", "Hex", "ChicagoManual", "Kanji", "KanjiDigit", "AiueoHalfWidth", "IrohaHalfWidth", "ArabicFullWidth", "ArabicHalfWidth", "KanjiTraditional", "KanjiTraditional2", "NumberInCircle", "DecimalFullWidth", "Aiueo", "Iroha", "LeadingZero", "Bullet", "Ganada", "Chosung", "GB1", "GB2", "GB3", "GB4", "Zodiac1", "Zodiac2", "Zodiac3", "TradChinNum1", "TradChinNum2", "TradChinNum3", "TradChinNum4", "SimpChinNum1", "SimpChinNum2", "SimpChinNum3", "SimpChinNum4", "HanjaRead", "HanjaReadDigit", "Hangul", "Hanja", "Hebrew1", "Arabic1", "Hebrew2", "Arabic2", "HindiLetter1", "HindiLetter2", "HindiArabic", "HindiCardinalText", "ThaiLetter", "ThaiArabic", "ThaiCardinalText", "VietCardinalText", "NumberInDash", "LowercaseRussian", "UppercaseRussian", "None", "Custom"])
  return false unless number_style_validator.valid?(@number_style)
  trailing_character_validator = EnumAttributeValidator.new('String', ["Tab", "Space", "Nothing"])
  return false unless trailing_character_validator.valid?(@trailing_character)

  return true
end