sdl4r 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/CHANGELOG +28 -0
  2. data/README +9 -0
  3. data/Rakefile +3 -2
  4. data/TODO +78 -0
  5. data/doc/classes/SDL4R.html +207 -53
  6. data/doc/classes/SDL4R/Parser.html +111 -49
  7. data/doc/classes/SDL4R/SdlBinary.html +125 -65
  8. data/doc/classes/SDL4R/SdlParseError.html +52 -30
  9. data/doc/classes/SDL4R/SdlTimeSpan.html +497 -279
  10. data/doc/classes/SDL4R/Tag.html +866 -514
  11. data/doc/created.rid +1 -1
  12. data/doc/files/CHANGELOG.html +52 -25
  13. data/doc/files/LICENSE.html +43 -52
  14. data/doc/files/README.html +52 -43
  15. data/doc/files/lib/sdl4r/parser/reader_rb.html +16 -27
  16. data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +17 -21
  17. data/doc/files/lib/sdl4r/parser/token_rb.html +17 -21
  18. data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +17 -21
  19. data/doc/files/lib/sdl4r/parser_rb.html +21 -22
  20. data/doc/files/lib/sdl4r/sdl4r_rb.html +25 -25
  21. data/doc/files/lib/sdl4r/sdl_binary_rb.html +17 -21
  22. data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +17 -21
  23. data/doc/files/lib/sdl4r/sdl_time_span_rb.html +17 -21
  24. data/doc/files/lib/sdl4r/tag_rb.html +25 -24
  25. data/doc/files/lib/sdl4r_rb.html +17 -21
  26. data/doc/fr_class_index.html +15 -12
  27. data/doc/fr_file_index.html +23 -12
  28. data/doc/fr_method_index.html +176 -91
  29. data/doc/index.html +7 -10
  30. data/doc/rdoc-style.css +210 -119
  31. data/lib/sdl4r.rb +3 -0
  32. data/lib/sdl4r/parser.rb +3 -5
  33. data/lib/sdl4r/parser/reader.rb +3 -3
  34. data/lib/sdl4r/parser/time_span_with_zone.rb +3 -0
  35. data/lib/sdl4r/parser/token.rb +3 -0
  36. data/lib/sdl4r/parser/tokenizer.rb +3 -0
  37. data/lib/sdl4r/sdl4r.rb +20 -8
  38. data/lib/sdl4r/sdl_binary.rb +3 -0
  39. data/lib/sdl4r/sdl_parse_error.rb +3 -0
  40. data/lib/sdl4r/sdl_time_span.rb +3 -0
  41. data/lib/sdl4r/tag.rb +18 -4
  42. data/test/sdl4r/parser_test.rb +7 -2
  43. data/test/sdl4r/sdl4r_test.rb +6 -2
  44. data/test/sdl4r/sdl_test.rb +3 -0
  45. data/test/sdl4r/tag_test.rb +3 -0
  46. metadata +72 -74
  47. data/TODO.txt +0 -177
data/lib/sdl4r/parser.rb CHANGED
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -637,11 +640,6 @@ module SDL4R
637
640
  seconds = seconds.to_i
638
641
 
639
642
  return SDLTimeSpan.new(days, hours, minutes, seconds, milliseconds)
640
-
641
- raise ArgumentError,
642
- "Malformed time span <#{literal}>. Time spans must use the format " +
643
- "(d:)hh:mm:ss(.xxx) Note: if the day component is " +
644
- "included it must be suffixed with lower case \"d\""
645
643
  end
646
644
 
647
645
  # Close the reader and throw a SdlParseError using the format
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -24,9 +27,6 @@ module SDL4R
24
27
  # Parser class from these problems.
25
28
  class Reader # :nodoc: all
26
29
 
27
- RUBY_1_8_OR_LESS = require 'jcode'
28
-
29
-
30
30
  # +io+ an open IO from which the characters are read.
31
31
  def initialize(io)
32
32
  raise ArgumentError, "io == nil" if io.nil?
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
data/lib/sdl4r/sdl4r.rb CHANGED
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -15,7 +18,6 @@
15
18
  # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
19
  #++
17
20
 
18
- require 'jcode'
19
21
  require 'base64'
20
22
  require 'bigdecimal'
21
23
  require 'date'
@@ -100,7 +102,7 @@ module SDL4R
100
102
  # Below, we use "#{o.year}" instead of "%Y" because "%Y" always emit 4 chars at least even if
101
103
  # the date is before 1000.
102
104
  elsif o.is_a?(DateTime) || o.is_a?(Time)
103
- milliseconds = o.is_a?(DateTime) ? get_date_milliseconds(o) : (o.usec / 10).to_i
105
+ milliseconds = get_datetime_milliseconds(o)
104
106
 
105
107
  if milliseconds == 0
106
108
  if o.zone
@@ -341,12 +343,22 @@ module SDL4R
341
343
  return escaped_s
342
344
  end
343
345
 
344
- # Returns the milliseonds part of a DateTime (by translating the +sec_fraction+ part) as an
345
- # integer.
346
- def get_date_milliseconds(date)
347
- sec_fraction = date.sec_fraction() # in days
348
- # 86400000 is the number of milliseconds in a day
349
- return (sec_fraction * 86400000).round()
346
+ # Returns the microseconds component of the given DateTime or Time.
347
+ # DateTime and Time having vastly different behaviors between themselves or in Ruby 1.8 and 1.9,
348
+ # this method makes an attemps at getting this component out of the specified object.
349
+ #
350
+ # In particular, DateTime.sec_fraction() (which I used before) returns incorrect values in, at
351
+ # least, some revisions of Ruby 1.9.
352
+ #
353
+ def get_datetime_milliseconds(datetime)
354
+ if defined?(datetime.usec)
355
+ return (datetime.usec / 1000).round
356
+ else
357
+ # Here don't believe that we could use '%3N' to get the milliseconds directly: the "3" is
358
+ # ignored for DateTime.strftime() in Ruby 1.8.
359
+ nanoseconds = Integer(datetime.strftime("%N"))
360
+ return (nanoseconds / 1000000).round
361
+ end
350
362
  end
351
363
 
352
364
  end
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
data/lib/sdl4r/tag.rb CHANGED
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -201,6 +204,7 @@ module SDL4R
201
204
  #
202
205
  def clear_children
203
206
  @children = []
207
+ nil
204
208
  end
205
209
 
206
210
  #
@@ -208,10 +212,14 @@ module SDL4R
208
212
  # {@link #addValue(Object)} for legal types.
209
213
  #
210
214
  # +value+:: The value to be set.
211
- # @throws IllegalArgumentException if the value is not a legal SDL type
215
+ #
216
+ # === Raises
217
+ #
218
+ # +ArgumentError+:: if the value is not a legal SDL type
212
219
  #
213
220
  def value=(value)
214
221
  @values[0] = SDL4R.coerce_or_fail(value)
222
+ nil
215
223
  end
216
224
 
217
225
  #
@@ -255,10 +263,11 @@ module SDL4R
255
263
 
256
264
  if block_given?
257
265
  each_child(recursive, namespace, name, &block)
266
+ return nil
258
267
 
259
268
  else
260
269
  unless recursive or name or namespace
261
- @children
270
+ return @children
262
271
 
263
272
  else
264
273
  result = []
@@ -399,6 +408,7 @@ module SDL4R
399
408
  #
400
409
  def add_value(v)
401
410
  @values.push(SDL4R::coerce_or_fail(v))
411
+ return nil
402
412
  end
403
413
 
404
414
  # Returns true if +v+ is a value of this Tag's.
@@ -426,6 +436,7 @@ module SDL4R
426
436
  #
427
437
  def clear_values
428
438
  @values = []
439
+ nil
429
440
  end
430
441
 
431
442
  # Returns an Array of the values of this Tag or enumerates them.
@@ -436,12 +447,12 @@ module SDL4R
436
447
  def values # :yields: value
437
448
  if block_given?
438
449
  @values.each { |v| yield v }
450
+ nil
439
451
  else
440
452
  return @values
441
453
  end
442
454
  end
443
455
 
444
- #
445
456
  # Set the values for this tag. See {@link #addValue(Object)} for legal
446
457
  # value types.
447
458
  #
@@ -455,6 +466,7 @@ module SDL4R
455
466
  # this is required to ensure validation of types
456
467
  add_value(v)
457
468
  }
469
+ nil
458
470
  end
459
471
 
460
472
  # set_attribute(key, value)
@@ -680,7 +692,7 @@ module SDL4R
680
692
  read_from_io(true) { StringIO.new(input) }
681
693
 
682
694
  elsif input.is_a? Pathname
683
- read_from_io(true) { input.open("r") }
695
+ read_from_io(true) { input.open("r:UTF-8") }
684
696
 
685
697
  elsif input.is_a? URI
686
698
  read_from_io(true) { input.open }
@@ -729,6 +741,8 @@ module SDL4R
729
741
  end
730
742
 
731
743
  io.close()
744
+
745
+ nil
732
746
  end
733
747
 
734
748
  #
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -22,10 +25,12 @@ module SDL4R
22
25
  require 'test/unit'
23
26
 
24
27
  require File.dirname(__FILE__) + '/../../lib/sdl4r/tag'
25
- require File.dirname(__FILE__) + '/../../lib/sdl4r/sdl_binary'
26
28
 
27
29
  class ParserTest < Test::Unit::TestCase
28
30
 
31
+ @@zone_offset = Rational(Time.now.utc_offset, 24 * 60 * 60)
32
+
33
+
29
34
  public
30
35
 
31
36
  def test_empty
@@ -341,7 +346,7 @@ EOF
341
346
  # Creates and returns a DateTime where an unspecified +zone_offset+ means 'the local zone
342
347
  # offset' (contrarily to DateTime#civil())
343
348
  def local_civil_date(year, month, day, hour = 0, min = 0, sec = 0, zone_offset = nil)
344
- zone_offset = Rational(Time.now.utc_offset, 24 * 60 * 60) if zone_offset.nil?
349
+ zone_offset ||= @@zone_offset
345
350
  return DateTime.civil(year, month, day, hour, min, sec, zone_offset)
346
351
  end
347
352
 
@@ -1,4 +1,8 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
5
+ #
2
6
  # Simple Declarative Language (SDL) for Ruby
3
7
  # Copyright 2005 Ikayzo, inc.
4
8
  #
@@ -139,8 +143,8 @@ module SDL4R
139
143
 
140
144
  write_parse_root = Tag.new("test").read(root.to_s).child("root");
141
145
 
142
- File.open("d:\\dev\\tmp\\root.sdl", "w") { |io| io.write(root.to_string) }
143
- File.open("d:\\dev\\tmp\\root_reparsed.sdl", "w") { |io| io.write(write_parse_root.to_string) }
146
+ # File.open("d:\\dev\\tmp\\root.sdl", "w") { |io| io.write(root.to_string) }
147
+ # File.open("d:\\dev\\tmp\\root_reparsed.sdl", "w") { |io| io.write(write_parse_root.to_string) }
144
148
 
145
149
  assert_tags_equal(root, write_parse_root, "write/parse")
146
150
  end
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+
1
4
  #--
2
5
  # Simple Declarative Language (SDL) for Ruby
3
6
  # Copyright 2005 Ikayzo, inc.
metadata CHANGED
@@ -3,19 +3,19 @@ name: sdl4r
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
- - 0
7
- - 9
8
- - 4
9
- version: 0.9.4
6
+ - 0
7
+ - 9
8
+ - 5
9
+ version: 0.9.5
10
10
  platform: ruby
11
11
  authors:
12
- - Philippe Vosges
13
- - Daniel Leuck
12
+ - Philippe Vosges
13
+ - Daniel Leuck
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-06 00:00:00 +09:00
18
+ date: 2010-08-08 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -28,54 +28,54 @@ extensions: []
28
28
  extra_rdoc_files: []
29
29
 
30
30
  files:
31
- - lib/sdl4r.rb
32
- - lib/sdl4r/sdl_time_span.rb
33
- - lib/sdl4r/sdl_parse_error.rb
34
- - lib/sdl4r/tag.rb
35
- - lib/sdl4r/parser.rb
36
- - lib/sdl4r/sdl_binary.rb
37
- - lib/sdl4r/sdl4r.rb
38
- - lib/sdl4r/parser/reader.rb
39
- - lib/sdl4r/parser/tokenizer.rb
40
- - lib/sdl4r/parser/token.rb
41
- - lib/sdl4r/parser/time_span_with_zone.rb
42
- - README
43
- - TODO.txt
44
- - Rakefile
45
- - LICENSE
46
- - CHANGELOG
47
- - test/sdl4r/parser_test.rb
48
- - test/sdl4r/tag_test.rb
49
- - test/sdl4r/sdl_test.rb
50
- - test/sdl4r/test_structures.sdl
51
- - test/sdl4r/test_basic_types.sdl
52
- - test/sdl4r/sdl4r_test.rb
53
- - doc/rdoc-style.css
54
- - doc/fr_file_index.html
55
- - doc/fr_class_index.html
56
- - doc/fr_method_index.html
57
- - doc/index.html
58
- - doc/created.rid
59
- - doc/files/README.html
60
- - doc/files/LICENSE.html
61
- - doc/files/CHANGELOG.html
62
- - doc/files/lib/sdl4r_rb.html
63
- - doc/files/lib/sdl4r/sdl_time_span_rb.html
64
- - doc/files/lib/sdl4r/sdl_parse_error_rb.html
65
- - doc/files/lib/sdl4r/tag_rb.html
66
- - doc/files/lib/sdl4r/parser_rb.html
67
- - doc/files/lib/sdl4r/sdl_binary_rb.html
68
- - doc/files/lib/sdl4r/sdl4r_rb.html
69
- - doc/files/lib/sdl4r/parser/reader_rb.html
70
- - doc/files/lib/sdl4r/parser/tokenizer_rb.html
71
- - doc/files/lib/sdl4r/parser/token_rb.html
72
- - doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html
73
- - doc/classes/SDL4R.html
74
- - doc/classes/SDL4R/Parser.html
75
- - doc/classes/SDL4R/Tag.html
76
- - doc/classes/SDL4R/SdlBinary.html
77
- - doc/classes/SDL4R/SdlParseError.html
78
- - doc/classes/SDL4R/SdlTimeSpan.html
31
+ - lib/sdl4r.rb
32
+ - lib/sdl4r/sdl_time_span.rb
33
+ - lib/sdl4r/sdl_parse_error.rb
34
+ - lib/sdl4r/tag.rb
35
+ - lib/sdl4r/parser.rb
36
+ - lib/sdl4r/sdl_binary.rb
37
+ - lib/sdl4r/parser/reader.rb
38
+ - lib/sdl4r/parser/tokenizer.rb
39
+ - lib/sdl4r/parser/token.rb
40
+ - lib/sdl4r/parser/time_span_with_zone.rb
41
+ - lib/sdl4r/sdl4r.rb
42
+ - README
43
+ - Rakefile
44
+ - LICENSE
45
+ - CHANGELOG
46
+ - TODO
47
+ - test/sdl4r/parser_test.rb
48
+ - test/sdl4r/tag_test.rb
49
+ - test/sdl4r/sdl_test.rb
50
+ - test/sdl4r/test_structures.sdl
51
+ - test/sdl4r/test_basic_types.sdl
52
+ - test/sdl4r/sdl4r_test.rb
53
+ - doc/rdoc-style.css
54
+ - doc/files/README.html
55
+ - doc/files/LICENSE.html
56
+ - doc/files/CHANGELOG.html
57
+ - doc/files/lib/sdl4r_rb.html
58
+ - doc/files/lib/sdl4r/sdl_time_span_rb.html
59
+ - doc/files/lib/sdl4r/sdl_parse_error_rb.html
60
+ - doc/files/lib/sdl4r/tag_rb.html
61
+ - doc/files/lib/sdl4r/parser_rb.html
62
+ - doc/files/lib/sdl4r/sdl_binary_rb.html
63
+ - doc/files/lib/sdl4r/parser/reader_rb.html
64
+ - doc/files/lib/sdl4r/parser/tokenizer_rb.html
65
+ - doc/files/lib/sdl4r/parser/token_rb.html
66
+ - doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html
67
+ - doc/files/lib/sdl4r/sdl4r_rb.html
68
+ - doc/classes/SDL4R.html
69
+ - doc/classes/SDL4R/SdlTimeSpan.html
70
+ - doc/classes/SDL4R/SdlParseError.html
71
+ - doc/classes/SDL4R/Tag.html
72
+ - doc/classes/SDL4R/Parser.html
73
+ - doc/classes/SDL4R/SdlBinary.html
74
+ - doc/fr_file_index.html
75
+ - doc/fr_class_index.html
76
+ - doc/fr_method_index.html
77
+ - doc/index.html
78
+ - doc/created.rid
79
79
  has_rdoc: true
80
80
  homepage: http://www.ikayzo.org/confluence/display/SDL/Home
81
81
  licenses: []
@@ -84,32 +84,30 @@ post_install_message:
84
84
  rdoc_options: []
85
85
 
86
86
  require_paths:
87
- - lib
87
+ - lib
88
88
  required_ruby_version: !ruby/object:Gem::Requirement
89
- none: false
90
89
  requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- segments:
94
- - 0
95
- version: "0"
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ version: "0"
96
95
  required_rubygems_version: !ruby/object:Gem::Requirement
97
- none: false
98
96
  requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- segments:
102
- - 0
103
- version: "0"
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 0
101
+ version: "0"
104
102
  requirements:
105
- - none
103
+ - none
106
104
  rubyforge_project: sdl4r
107
- rubygems_version: 1.3.7
105
+ rubygems_version: 1.3.6
108
106
  signing_key:
109
107
  specification_version: 3
110
108
  summary: Simple Declarative Language for Ruby library
111
109
  test_files:
112
- - test/sdl4r/parser_test.rb
113
- - test/sdl4r/tag_test.rb
114
- - test/sdl4r/sdl_test.rb
115
- - test/sdl4r/sdl4r_test.rb
110
+ - test/sdl4r/parser_test.rb
111
+ - test/sdl4r/tag_test.rb
112
+ - test/sdl4r/sdl_test.rb
113
+ - test/sdl4r/sdl4r_test.rb