athena 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to athena version 0.1.2
5
+ This documentation refers to athena version 0.1.3
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -3,7 +3,7 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2009 University of Cologne, #
6
+ # Copyright (C) 2007-2010 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50932 Cologne, Germany #
9
9
  # #
@@ -137,7 +137,7 @@ module Athena::Formats
137
137
 
138
138
  def setup_specs(config)
139
139
  case @record_element = config.delete(:__record_element)
140
- when String
140
+ when String, Array
141
141
  # fine!
142
142
  when nil
143
143
  raise NoRecordElementError, 'no record element specified'
@@ -145,6 +145,15 @@ module Athena::Formats
145
145
  raise IllegalRecordElementError, "illegal record element #{@record_element.inspect}"
146
146
  end
147
147
 
148
+ case @skip_hierarchy = config.delete(:__skip_hierarchy)
149
+ when Integer
150
+ # fine!
151
+ when nil
152
+ @skip_hierarchy = 0
153
+ else
154
+ raise ConfigError, "illegal value #{@skip_hierarchy.inspect} for skip hierarchy"
155
+ end
156
+
148
157
  config.inject({}) { |specs, (element, element_spec)|
149
158
  element_spec.each { |field, c|
150
159
  element.split('/').reverse.inject({}) { |hash, part|
@@ -164,11 +173,16 @@ module Athena::Formats
164
173
  record_spec.specs!(specs)
165
174
 
166
175
  root_spec = BaseSpec.new
167
- root_spec.specs!(record_element => record_spec)
176
+ [*record_element].each { |re| root_spec.specs!(re => record_spec) }
168
177
 
169
178
  spec = BaseSpec.new
170
179
  spec.default!(root_spec)
171
180
 
181
+ @skip_hierarchy.times {
182
+ prev_spec, spec = spec, BaseSpec.new
183
+ spec.default!(prev_spec)
184
+ }
185
+
172
186
  verbose(:spec, BaseSpec) do
173
187
  spec.inspect_spec
174
188
  end
@@ -344,10 +358,12 @@ module Athena::Formats
344
358
 
345
359
  end
346
360
 
347
- class NoRecordElementError < StandardError
361
+ ConfigError = Athena::Parser::ConfigError
362
+
363
+ class NoRecordElementError < ConfigError
348
364
  end
349
365
 
350
- class IllegalRecordElementError < StandardError
366
+ class IllegalRecordElementError < ConfigError
351
367
  end
352
368
 
353
369
  end
data/lib/athena/parser.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2009 University of Cologne, #
6
+ # Copyright (C) 2007-2010 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50932 Cologne, Germany #
9
9
  # #
@@ -83,4 +83,7 @@ class Athena::Parser
83
83
  }
84
84
  end
85
85
 
86
+ class ConfigError < StandardError
87
+ end
88
+
86
89
  end
@@ -30,7 +30,7 @@ module Athena::Version
30
30
 
31
31
  MAJOR = 0
32
32
  MINOR = 1
33
- TINY = 2
33
+ TINY = 3
34
34
 
35
35
  class << self
36
36
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: athena
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-03 00:00:00 +01:00
12
+ date: 2010-02-05 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -53,40 +53,40 @@ extra_rdoc_files:
53
53
  - ChangeLog
54
54
  - README
55
55
  files:
56
- - lib/athena.rb
57
- - lib/athena/formats/sisis.rb
58
- - lib/athena/formats/dbm.rb
56
+ - lib/athena/util.rb
57
+ - lib/athena/record.rb
59
58
  - lib/athena/formats/xml.rb
60
59
  - lib/athena/formats/lingo.rb
61
60
  - lib/athena/formats/ferret.rb
62
- - lib/athena/formats.rb
61
+ - lib/athena/formats/dbm.rb
62
+ - lib/athena/formats/sisis.rb
63
63
  - lib/athena/version.rb
64
- - lib/athena/util.rb
65
- - lib/athena/record.rb
66
64
  - lib/athena/parser.rb
65
+ - lib/athena/formats.rb
66
+ - lib/athena.rb
67
67
  - bin/athena
68
+ - README
69
+ - ChangeLog
68
70
  - Rakefile
69
71
  - COPYING
70
- - ChangeLog
71
- - README
72
- - example/sisis-ex.txt
73
72
  - example/config.yaml
74
73
  - example/example.xml
74
+ - example/sisis-ex.txt
75
75
  has_rdoc: true
76
76
  homepage: http://prometheus.rubyforge.org/athena
77
77
  licenses: []
78
78
 
79
79
  post_install_message:
80
80
  rdoc_options:
81
- - --title
82
- - athena Application documentation
83
- - --main
84
- - README
85
81
  - --line-numbers
86
82
  - --inline-source
87
- - --all
83
+ - --main
84
+ - README
88
85
  - --charset
89
86
  - UTF-8
87
+ - --title
88
+ - athena Application documentation
89
+ - --all
90
90
  require_paths:
91
91
  - lib
92
92
  required_ruby_version: !ruby/object:Gem::Requirement