ruby_pptx 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +83 -2
  4. data/lib/ruby_pptx/action.rb +12 -4
  5. data/lib/ruby_pptx/autoshape_spec.rb +6 -2
  6. data/lib/ruby_pptx/builder.rb +3 -1
  7. data/lib/ruby_pptx/chart/categories.rb +45 -15
  8. data/lib/ruby_pptx/chart/chart.rb +77 -27
  9. data/lib/ruby_pptx/chart/combo.rb +9 -3
  10. data/lib/ruby_pptx/chart/data.rb +45 -15
  11. data/lib/ruby_pptx/chart/format.rb +229 -76
  12. data/lib/ruby_pptx/chart/workbook_writer.rb +9 -3
  13. data/lib/ruby_pptx/chart/xml_writer.rb +54 -18
  14. data/lib/ruby_pptx/chart/xy_data.rb +68 -22
  15. data/lib/ruby_pptx/dml/color.rb +27 -9
  16. data/lib/ruby_pptx/dml/effect.rb +6 -2
  17. data/lib/ruby_pptx/dml/fill.rb +42 -14
  18. data/lib/ruby_pptx/element_proxy.rb +12 -4
  19. data/lib/ruby_pptx/enum/base.rb +30 -10
  20. data/lib/ruby_pptx/enum/prog_id.rb +3 -1
  21. data/lib/ruby_pptx/geometry.rb +32 -10
  22. data/lib/ruby_pptx/image.rb +27 -9
  23. data/lib/ruby_pptx/length.rb +94 -27
  24. data/lib/ruby_pptx/media.rb +12 -4
  25. data/lib/ruby_pptx/numeric_lengths.rb +34 -9
  26. data/lib/ruby_pptx/opc/oxml.rb +7 -5
  27. data/lib/ruby_pptx/opc/pack_uri.rb +15 -5
  28. data/lib/ruby_pptx/opc/package.rb +97 -31
  29. data/lib/ruby_pptx/opc/serialized.rb +15 -5
  30. data/lib/ruby_pptx/oxml/backend.rb +585 -0
  31. data/lib/ruby_pptx/oxml/chart.rb +112 -42
  32. data/lib/ruby_pptx/oxml/content_model.rb +6 -2
  33. data/lib/ruby_pptx/oxml/dml/color.rb +6 -2
  34. data/lib/ruby_pptx/oxml/dml/fill.rb +6 -2
  35. data/lib/ruby_pptx/oxml/element.rb +138 -101
  36. data/lib/ruby_pptx/oxml/ns.rb +7 -7
  37. data/lib/ruby_pptx/oxml/presentation.rb +9 -3
  38. data/lib/ruby_pptx/oxml/section.rb +3 -1
  39. data/lib/ruby_pptx/oxml/shapes/autoshape.rb +39 -13
  40. data/lib/ruby_pptx/oxml/shapes/groupshape.rb +15 -7
  41. data/lib/ruby_pptx/oxml/shapes/other.rb +47 -16
  42. data/lib/ruby_pptx/oxml/shapes/shared.rb +96 -30
  43. data/lib/ruby_pptx/oxml/simple_types.rb +169 -52
  44. data/lib/ruby_pptx/oxml/slide.rb +24 -8
  45. data/lib/ruby_pptx/oxml/table.rb +39 -13
  46. data/lib/ruby_pptx/oxml/text.rb +37 -15
  47. data/lib/ruby_pptx/oxml/theme.rb +13 -4
  48. data/lib/ruby_pptx/package.rb +9 -3
  49. data/lib/ruby_pptx/parts/chart.rb +6 -2
  50. data/lib/ruby_pptx/parts/image.rb +12 -4
  51. data/lib/ruby_pptx/parts/media.rb +3 -1
  52. data/lib/ruby_pptx/parts/presentation.rb +15 -5
  53. data/lib/ruby_pptx/parts/slide.rb +33 -11
  54. data/lib/ruby_pptx/parts/theme.rb +3 -1
  55. data/lib/ruby_pptx/pattern_matching.rb +6 -2
  56. data/lib/ruby_pptx/presentation.rb +24 -8
  57. data/lib/ruby_pptx/section.rb +30 -10
  58. data/lib/ruby_pptx/shapes/adjustments.rb +9 -3
  59. data/lib/ruby_pptx/shapes/authoring.rb +3 -1
  60. data/lib/ruby_pptx/shapes/base.rb +74 -24
  61. data/lib/ruby_pptx/shapes/freeform.rb +36 -12
  62. data/lib/ruby_pptx/shapes/placeholder.rb +44 -15
  63. data/lib/ruby_pptx/shapes/shape.rb +91 -30
  64. data/lib/ruby_pptx/shapes/shape_tree.rb +66 -22
  65. data/lib/ruby_pptx/slide.rb +123 -41
  66. data/lib/ruby_pptx/table.rb +105 -35
  67. data/lib/ruby_pptx/text/font_metrics.rb +30 -9
  68. data/lib/ruby_pptx/text/text.rb +108 -36
  69. data/lib/ruby_pptx/theme.rb +30 -10
  70. data/lib/ruby_pptx/version.rb +1 -1
  71. data/lib/ruby_pptx.rb +8 -1
  72. metadata +22 -1
@@ -50,17 +50,25 @@ module Pptx
50
50
  series
51
51
  end
52
52
 
53
- def each(&) = @series.each(&)
53
+ def each(&)
54
+ @series.each(&)
55
+ end
54
56
 
55
- def size = @series.size
57
+ def size
58
+ @series.size
59
+ end
56
60
 
57
61
  # The number of categories plotted: the leaves, when they are grouped.
58
- def category_count = @categories.leaf_count
62
+ def category_count
63
+ @categories.leaf_count
64
+ end
59
65
 
60
66
  # True when the categories are numbers or dates, which makes the category
61
67
  # cache numeric rather than textual. Decided by the first category, as
62
68
  # python-pptx decides it.
63
- def numeric_categories? = @categories.numeric?
69
+ def numeric_categories?
70
+ @categories.numeric?
71
+ end
64
72
 
65
73
  # @api private
66
74
  # The category block: one column per level, one row per leaf.
@@ -72,7 +80,9 @@ module Pptx
72
80
  end
73
81
 
74
82
  # @api private
75
- def series_name_ref(series) = "#{WORKSHEET_NAME}!$#{column_letter(series)}$1"
83
+ def series_name_ref(series)
84
+ "#{WORKSHEET_NAME}!$#{column_letter(series)}$1"
85
+ end
76
86
 
77
87
  # @api private
78
88
  # As long as the series itself, which python-pptx also measures by the
@@ -85,7 +95,9 @@ module Pptx
85
95
 
86
96
  # @api private
87
97
  # The Excel column letter for a series: after the category columns.
88
- def column_letter(series) = ChartData.column_reference(1 + @categories.depth + series.index)
98
+ def column_letter(series)
99
+ ChartData.column_reference(1 + @categories.depth + series.index)
100
+ end
89
101
 
90
102
  # Excel's bijective base-26 column names: 1 => "A", 27 => "AA".
91
103
  def self.column_reference(column_number)
@@ -102,9 +114,13 @@ module Pptx
102
114
 
103
115
  # @api private
104
116
  # Bytes of the embedded Excel workbook holding this data.
105
- def xlsx_blob = ChartWorkbookWriter.new(self).blob
117
+ def xlsx_blob
118
+ ChartWorkbookWriter.new(self).blob
119
+ end
106
120
 
107
- def inspect = "#<Pptx::ChartData categories=#{category_count} series=#{size}>"
121
+ def inspect
122
+ "#<Pptx::ChartData categories=#{category_count} series=#{size}>"
123
+ end
108
124
  end
109
125
 
110
126
  # One series of a chart: a name and one value per category.
@@ -121,9 +137,13 @@ module Pptx
121
137
  @number_format = number_format
122
138
  end
123
139
 
124
- def each(&) = @values.each(&)
140
+ def each(&)
141
+ @values.each(&)
142
+ end
125
143
 
126
- def size = @values.size
144
+ def size
145
+ @values.size
146
+ end
127
147
 
128
148
  # Append one value, for building a series up point by point.
129
149
  #
@@ -134,14 +154,24 @@ module Pptx
134
154
  self
135
155
  end
136
156
 
137
- def categories = @chart_data.categories
157
+ def categories
158
+ @chart_data.categories
159
+ end
138
160
 
139
- def name_ref = @chart_data.series_name_ref(self)
161
+ def name_ref
162
+ @chart_data.series_name_ref(self)
163
+ end
140
164
 
141
- def values_ref = @chart_data.series_values_ref(self)
165
+ def values_ref
166
+ @chart_data.series_values_ref(self)
167
+ end
142
168
 
143
- def categories_ref = @chart_data.categories_ref
169
+ def categories_ref
170
+ @chart_data.categories_ref
171
+ end
144
172
 
145
- def inspect = "#<Pptx::ChartSeries #{@name.inspect} #{size} values>"
173
+ def inspect
174
+ "#<Pptx::ChartSeries #{@name.inspect} #{size} values>"
175
+ end
146
176
  end
147
177
  end