dyi 1.1.0 → 1.1.1

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.
@@ -59,7 +59,6 @@ module DYI
59
59
  # Writes the buffer contents of the object.
60
60
  # @param [Formatter::Base] a formatter for export
61
61
  # @param [IO] io a buffer that is written
62
- # @return [void]
63
62
  def write_as(formatter, io=$>)
64
63
  formatter.write_style(self, io)
65
64
  end
data/lib/ironruby.rb CHANGED
@@ -26,7 +26,8 @@ require 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f
26
26
  require 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
27
27
  require File.join(File.dirname(__FILE__), 'dyi/formatter/emf_formatter')
28
28
 
29
- class BigDecimal < Numeric #:nodoc:
29
+
30
+ class BigDecimal < Numeric
30
31
  alias __org_div__ div
31
32
  def div(other)
32
33
  case other
@@ -37,15 +38,15 @@ class BigDecimal < Numeric #:nodoc:
37
38
  end
38
39
  end
39
40
 
40
- module DYI #:nodoc:
41
+ module DYI
41
42
 
42
- class Coordinate #:nodoc:
43
+ class Coordinate
43
44
  def to_cls_point
44
45
  System::Drawing::PointF.new(x.to_f, y.to_f)
45
46
  end
46
47
  end
47
48
 
48
- class Color #:nodoc:
49
+ class Color
49
50
  def to_cls_color(opacity=nil)
50
51
  if opacity
51
52
  System::Drawing::Color.from_argb((opacity.to_f * 255).to_i, @r, @g, @b)
@@ -63,7 +64,7 @@ module DYI #:nodoc:
63
64
  end
64
65
  end
65
66
 
66
- class Painting #:nodoc:
67
+ class Painting
67
68
  def cls_line_join
68
69
  case stroke_linejoin
69
70
  when 'miter' then System::Drawing::Drawing2D::LineJoin.miter
@@ -114,7 +115,7 @@ module DYI #:nodoc:
114
115
  end
115
116
  end
116
117
 
117
- class Font #:nodoc:
118
+ class Font
118
119
  def to_cls_font
119
120
  System::Drawing::Font.new(font_family || '', size ? size.to_f : DEFAULT_SIZE.to_f('pt'))
120
121
  end
@@ -126,14 +127,14 @@ module DYI #:nodoc:
126
127
  end
127
128
  end
128
129
 
129
- class Matrix #:nodoc:
130
+ class Matrix
130
131
  def to_cls_matrix
131
132
  System::Drawing::Drawing2D::Matrix.new(xx, yx, xy, yy, x0, y0)
132
133
  end
133
134
  end
134
135
 
135
- module Shape #:nodoc:
136
- class Text < Base #:nodoc:
136
+ module Shape
137
+ class Text < Base
137
138
  def string_format
138
139
  format = System::Drawing::StringFormat.new
139
140
  format.alignment =
@@ -156,7 +157,7 @@ module DYI #:nodoc:
156
157
  end
157
158
  end
158
159
 
159
- class Canvas #:nodoc:
160
+ class Canvas
160
161
  private
161
162
  def get_formatter(format=nil)
162
163
  case format
@@ -169,8 +170,8 @@ module DYI #:nodoc:
169
170
  end
170
171
  end
171
172
 
172
- module Drawing #:nodoc:
173
- module ColorEffect #:nodoc:
173
+ module Drawing
174
+ module ColorEffect
174
175
  class LinearGradient
175
176
  def create_cls_brush(opacity=nil, shape=nil)
176
177
  brush = System::Drawing::Drawing2D::LinearGradientBrush.new(
@@ -227,8 +228,8 @@ module DYI #:nodoc:
227
228
  end
228
229
  end
229
230
 
230
- module Chart #:nodoc:
231
- class CsvReader < ArrayReader #:nodoc:
231
+ module Chart
232
+ class CsvReader < ArrayReader
232
233
  def read(path, options={})
233
234
  options = options.dup
234
235
  @date_format = options.delete(:date_format)
@@ -255,7 +256,7 @@ module DYI #:nodoc:
255
256
  end
256
257
  end
257
258
 
258
- class ExcelReader < ArrayReader #:nodoc:
259
+ class ExcelReader < ArrayReader
259
260
  def read(path, options={})
260
261
  if defined? WIN32OLE
261
262
  # for Windows
@@ -292,8 +293,8 @@ module DYI #:nodoc:
292
293
  end
293
294
  end
294
295
 
295
- module Formatter #:nodoc:
296
- class EpsFormatter < Base #:nodoc:
296
+ module Formatter
297
+ class EpsFormatter < Base
297
298
  def write_text(shape, io)
298
299
  command_block(io) {
299
300
  puts_line(io, '/GothicBBB-Medium-RKSJ-H findfont', shape.font.draw_size, 'scalefont setfont')
data/lib/util.rb CHANGED
@@ -19,8 +19,24 @@
19
19
  # You should have received a copy of the GNU General Public License
20
20
  # along with DYI. If not, see <http://www.gnu.org/licenses/>.
21
21
 
22
+ # Addes Numeirc class to {#strfnum} method.
22
23
  class Numeric
23
24
 
25
+ # Converts the numeric value of this instance to the string representation,
26
+ # using the numeric format string.
27
+ # @param [String] format the numeric format string
28
+ # @return [String] formated string that is equivalent to this instance
29
+ # @example
30
+ # 3.141592.strfnum('0.00') # => "3.14"
31
+ # 3.141592.strfnum('0.###') # => "3.142"
32
+ # 3.140159.strfnum('0.###') # => "3.14"
33
+ # 1234567.strfnum('#,##0') # => "1,234,567"
34
+ # 1234567.strfnum('#,##0,.0') # => "1,234.6"
35
+ # 0.56789.strfnum('0.0%') # => "56.8%"
36
+ # -12345.strfnum('#,##0') # => "-12,345"
37
+ # -12345.strfnum('#,##0;*#,##0') # => "*12,345"
38
+ # 0.001.strfnum('#,##0;-#,##0;zero') # => "zero"
39
+ # 12345.strfnum('\##,##0') # => "#12,345"
24
40
  def strfnum(format)
25
41
  decimal_separator = (defined? ::Numeric::DECIMAL_SEPARATOR) ? ::Numeric::DECIMAL_SEPARATOR : '.'
26
42
  group_separator = (defined? ::Numeric::GROUP_SEPARATOR) ? ::Numeric::GROUP_SEPARATOR : ','
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 0
10
- version: 1.1.0
9
+ - 1
10
+ version: 1.1.1
11
11
  platform: ruby
12
12
  authors:
13
- - Yuo
13
+ - Mamoru Yuo
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-06 00:00:00 +09:00
18
+ date: 2012-02-02 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -91,7 +91,7 @@ files:
91
91
  - test/path_command_test.rb
92
92
  - test/test_length.rb
93
93
  has_rdoc: true
94
- homepage: http://sourceforge.net/projects/dyi/
94
+ homepage: https://sourceforge.net/projects/dyi/
95
95
  licenses:
96
96
  - GPL-3
97
97
  post_install_message: