Class: AsposePdfCloud::Paragraph
- Inherits:
-
Object
- Object
- AsposePdfCloud::Paragraph
- Defined in:
- lib/aspose_pdf_cloud/models/paragraph.rb
Overview
Represents text paragraphs as multiline text object.
Instance Attribute Summary collapse
-
#bottom_margin ⇒ Object
Bottom margin.
-
#horizontal_alignment ⇒ Object
Horizontal alignment for the text inside paragraph’s rectangle.
-
#left_margin ⇒ Object
Left margin.
-
#line_spacing ⇒ Object
Line spacing mode.
-
#lines ⇒ Object
An array of text lines.
-
#rectangle ⇒ Object
Rectangle of the paragraph.
-
#right_margin ⇒ Object
Right margin.
-
#rotation ⇒ Object
Rotation angle in degrees.
-
#subsequent_lines_indent ⇒ Object
Subsequent lines indent value.
-
#top_margin ⇒ Object
Top margin.
-
#vertical_alignment ⇒ Object
Vertical alignment for the text inside paragraph’s rectangle.
-
#wrap_mode ⇒ Object
Word wrap mode.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Paragraph
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 = {}) ⇒ Paragraph
Initializes the object
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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 103 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.has_key?(:'LineSpacing') self.line_spacing = attributes[:'LineSpacing'] end if attributes.has_key?(:'WrapMode') self.wrap_mode = attributes[:'WrapMode'] end if attributes.has_key?(:'HorizontalAlignment') self.horizontal_alignment = attributes[:'HorizontalAlignment'] end if attributes.has_key?(:'LeftMargin') self.left_margin = attributes[:'LeftMargin'] end if attributes.has_key?(:'RightMargin') self.right_margin = attributes[:'RightMargin'] end if attributes.has_key?(:'TopMargin') self.top_margin = attributes[:'TopMargin'] end if attributes.has_key?(:'BottomMargin') self.bottom_margin = attributes[:'BottomMargin'] end if attributes.has_key?(:'Rectangle') self.rectangle = attributes[:'Rectangle'] end if attributes.has_key?(:'Rotation') self.rotation = attributes[:'Rotation'] end if attributes.has_key?(:'SubsequentLinesIndent') self.subsequent_lines_indent = attributes[:'SubsequentLinesIndent'] end if attributes.has_key?(:'VerticalAlignment') self.vertical_alignment = attributes[:'VerticalAlignment'] end if attributes.has_key?(:'Lines') if (value = attributes[:'Lines']).is_a?(Array) self.lines = value end end end |
Instance Attribute Details
#bottom_margin ⇒ Object
Bottom margin.
47 48 49 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 47 def bottom_margin @bottom_margin end |
#horizontal_alignment ⇒ Object
Horizontal alignment for the text inside paragraph’s rectangle.
35 36 37 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 35 def horizontal_alignment @horizontal_alignment end |
#left_margin ⇒ Object
Left margin.
38 39 40 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 38 def left_margin @left_margin end |
#line_spacing ⇒ Object
Line spacing mode.
29 30 31 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 29 def line_spacing @line_spacing end |
#lines ⇒ Object
An array of text lines.
62 63 64 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 62 def lines @lines end |
#rectangle ⇒ Object
Rectangle of the paragraph.
50 51 52 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 50 def rectangle @rectangle end |
#right_margin ⇒ Object
Right margin.
41 42 43 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 41 def right_margin @right_margin end |
#rotation ⇒ Object
Rotation angle in degrees.
53 54 55 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 53 def rotation @rotation end |
#subsequent_lines_indent ⇒ Object
Subsequent lines indent value.
56 57 58 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 56 def subsequent_lines_indent @subsequent_lines_indent end |
#top_margin ⇒ Object
Top margin.
44 45 46 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 44 def top_margin @top_margin end |
#vertical_alignment ⇒ Object
Vertical alignment for the text inside paragraph’s rectangle
59 60 61 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 59 def vertical_alignment @vertical_alignment end |
#wrap_mode ⇒ Object
Word wrap mode.
32 33 34 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 32 def wrap_mode @wrap_mode end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 66 def self.attribute_map { :'line_spacing' => :'LineSpacing', :'wrap_mode' => :'WrapMode', :'horizontal_alignment' => :'HorizontalAlignment', :'left_margin' => :'LeftMargin', :'right_margin' => :'RightMargin', :'top_margin' => :'TopMargin', :'bottom_margin' => :'BottomMargin', :'rectangle' => :'Rectangle', :'rotation' => :'Rotation', :'subsequent_lines_indent' => :'SubsequentLinesIndent', :'vertical_alignment' => :'VerticalAlignment', :'lines' => :'Lines' } end |
.swagger_types ⇒ Object
Attribute type mapping.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 84 def self.swagger_types { :'line_spacing' => :'LineSpacing', :'wrap_mode' => :'WrapMode', :'horizontal_alignment' => :'TextHorizontalAlignment', :'left_margin' => :'Float', :'right_margin' => :'Float', :'top_margin' => :'Float', :'bottom_margin' => :'Float', :'rectangle' => :'Rectangle', :'rotation' => :'Float', :'subsequent_lines_indent' => :'Float', :'vertical_alignment' => :'VerticalAlignment', :'lines' => :'Array<TextLine>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 181 def ==(o) return true if self.equal?(o) self.class == o.class && line_spacing == o.line_spacing && wrap_mode == o.wrap_mode && horizontal_alignment == o.horizontal_alignment && left_margin == o.left_margin && right_margin == o.right_margin && top_margin == o.top_margin && bottom_margin == o.bottom_margin && rectangle == o.rectangle && rotation == o.rotation && subsequent_lines_indent == o.subsequent_lines_indent && vertical_alignment == o.vertical_alignment && lines == o.lines end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 234 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.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 temp_model = AsposePdfCloud.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
300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 300 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
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 213 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?(o) ⇒ Boolean
200 201 202 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 200 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
206 207 208 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 206 def hash [line_spacing, wrap_mode, horizontal_alignment, left_margin, right_margin, top_margin, bottom_margin, rectangle, rotation, subsequent_lines_indent, vertical_alignment, lines].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
163 164 165 166 167 168 169 170 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 163 def list_invalid_properties invalid_properties = Array.new if @lines.nil? invalid_properties.push("invalid value for 'lines', lines cannot be nil.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
280 281 282 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 280 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
286 287 288 289 290 291 292 293 294 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 286 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_s ⇒ String
Returns the string representation of the object
274 275 276 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 274 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
174 175 176 177 |
# File 'lib/aspose_pdf_cloud/models/paragraph.rb', line 174 def valid? return false if @lines.nil? return true end |