marcspec 1.6.1 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -1
- data/VERSION +1 -1
- data/lib/marcspec/dsl.rb +11 -0
- data/lib/marcspec/map.rb +3 -3
- data/lib/marcspec/multivaluemap.rb +5 -3
- metadata +3 -3
data/CHANGES
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
1.6.3
|
2
|
+
* Fixed bad calls to logback::simple "log" object in class methods, where it wasn't available
|
3
|
+
|
4
|
+
1.6.2
|
5
|
+
* When declaring a function using the DSL, make sure it is defined in the given module
|
1
6
|
1.6.1
|
2
7
|
* Change VariableField#asDSLString to reflect compact declaration of spec with subs
|
3
|
-
|
4
8
|
1.6.0
|
5
9
|
* Allow specs like spec('245ac'), with or without a block as well.
|
6
10
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.3
|
data/lib/marcspec/dsl.rb
CHANGED
@@ -138,6 +138,17 @@ module MARCSpec
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def mod(constant)
|
141
|
+
# Is the module loaded?
|
142
|
+
|
143
|
+
unless defined? constant
|
144
|
+
raise ArgumentError, "Module #{constant} unknown; do you need to make sure it gets loaded?"
|
145
|
+
end
|
146
|
+
|
147
|
+
# Check to see if the functionSymbol exists
|
148
|
+
unless constant.singleton_methods.include? self.functionSymbol.to_s
|
149
|
+
raise ArgumentError, "Function #{self.functionSymbol} not defined in module #{constant}"
|
150
|
+
end
|
151
|
+
|
141
152
|
self.module = constant
|
142
153
|
end
|
143
154
|
|
data/lib/marcspec/map.rb
CHANGED
@@ -35,14 +35,14 @@ module MARCSpec
|
|
35
35
|
begin
|
36
36
|
str = File.open(filename).read
|
37
37
|
rescue Exception => e
|
38
|
-
|
38
|
+
Logback::Simple::Logger.fatal "Problem opening #{filename}: #{e.message}"
|
39
39
|
raise e
|
40
40
|
end
|
41
41
|
|
42
42
|
begin
|
43
43
|
rawmap = eval(str)
|
44
44
|
rescue Exception => e
|
45
|
-
|
45
|
+
Logback::Simple::Logger.fatal "Problem evaluating (with 'eval') file #{filename}: #{e.message}"
|
46
46
|
raise e
|
47
47
|
end
|
48
48
|
|
@@ -59,7 +59,7 @@ module MARCSpec
|
|
59
59
|
when :multi
|
60
60
|
return MultiValueMap.new(rawmap[:mapname], rawmap[:map])
|
61
61
|
else
|
62
|
-
|
62
|
+
Logback::Simple::Logger.fatal "Map file #{filename} doesn't seem to be either a KV map or a MuliValueMap according to :maptype (#{rawmap[:maptype]})"
|
63
63
|
raise ArgumentError, "File #{filename} doesn't evaluate to a valid map"
|
64
64
|
end
|
65
65
|
|
@@ -24,12 +24,11 @@ module MARCSpec
|
|
24
24
|
|
25
25
|
def initialize *args
|
26
26
|
super(*args)
|
27
|
-
self.optimize
|
27
|
+
self.optimize if @map and @mapname
|
28
28
|
end
|
29
29
|
|
30
30
|
def map= map
|
31
31
|
@map = map
|
32
|
-
self.optimize
|
33
32
|
end
|
34
33
|
|
35
34
|
|
@@ -98,7 +97,10 @@ module MARCSpec
|
|
98
97
|
kvlist << [Regexp.new(match[1]), match[2]]
|
99
98
|
end
|
100
99
|
end
|
101
|
-
|
100
|
+
rv = self.new(nil,nil) # empty; avoid the optimize
|
101
|
+
rv.mapname = mapname
|
102
|
+
rv.map = kvlist
|
103
|
+
return rv
|
102
104
|
end
|
103
105
|
|
104
106
|
# Produce a string suitable for pretty-printing. Unfortunately, we need to just plain
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 1.6.
|
8
|
+
- 3
|
9
|
+
version: 1.6.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- BillDueber
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-08 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|