dyi 1.0.1 → 1.0.2

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.
data/lib/dyi.rb CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
 
23
23
  module DYI
24
- VERSION = '1.0.0'
24
+ VERSION = '1.0.2'
25
25
  URL = 'http://sourceforge.net/projects/dyi/'
26
26
  end
27
27
 
data/lib/dyi/canvas.rb CHANGED
@@ -163,8 +163,7 @@ module DYI #:nodoc:
163
163
  # @since 1.0.0
164
164
  def add_initialize_script(script_body)
165
165
  if @init_script
166
- @init_script = Script::EcmaScript::EventListener.new(
167
- @init_script.instance_variable_get(:@body) + script_body, 'init')
166
+ @init_script.append_body(script_body)
168
167
  else
169
168
  @init_script = Script::EcmaScript::EventListener.new(script_body, 'init')
170
169
  add_event_listener(:load, @init_script)
@@ -57,6 +57,17 @@ module DYI
57
57
  false
58
58
  end
59
59
 
60
+ # Appends script.
61
+ # @param [String] script_body body of client scripting that is appended
62
+ # @since 1.0.2
63
+ def append_body(script_body)
64
+ if @body.to_s[-1,1] == "\n"
65
+ @body += script_body
66
+ else
67
+ @body = [@body, "\n", script_body].join
68
+ end
69
+ end
70
+
60
71
  # Writes the buffer contents of the object.
61
72
  # @param [Formatter::Base] a formatter for export
62
73
  # @param [IO] io a buffer that is written
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yuo
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-28 00:00:00 Z
18
+ date: 2011-09-30 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: " DYI is a 2D graphics library, very rich and expressive.\n DYI have been optimized for SVG format, but it is also possible\n to output other format; for example, EPS.\n"