scorm2004-manifest 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/scorm2004/manifest/attributes.rb +5 -5
- data/lib/scorm2004/manifest/dependency.rb +1 -11
- data/lib/scorm2004/manifest/item.rb +0 -12
- data/lib/scorm2004/manifest/organizations.rb +4 -4
- data/lib/scorm2004/manifest/rule_condition.rb +1 -1
- data/lib/scorm2004/manifest/time_limit_action.rb +2 -2
- data/lib/scorm2004/manifest/visitor_pattern.rb +1 -0
- data/test/scorm2004/manifest/dependency_test.rb +0 -8
- data/test/scorm2004/manifest/organizations_test.rb +2 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
@@ -32,7 +32,7 @@ module Scorm2004
|
|
32
32
|
base = basename(name)
|
33
33
|
attributes << base
|
34
34
|
define_method("raw_#{base}") do
|
35
|
-
@el.at("./@#{name}").try(:content) || options[:default].try(:to_s)
|
35
|
+
@el.at("./@#{name}", NS).try(:content) || options[:default].try(:to_s)
|
36
36
|
end
|
37
37
|
send("#{type}_attribute", name, options)
|
38
38
|
attr_reader base
|
@@ -67,10 +67,10 @@ module Scorm2004
|
|
67
67
|
def id_attribute(name, options)
|
68
68
|
base = basename(name)
|
69
69
|
define_method("check_#{base}".intern) do
|
70
|
-
|
71
|
-
error("No #{name} attribute.") unless options[:allow_nil] ||
|
72
|
-
error("Non xs:ID value for the #{name} attribute: #{
|
73
|
-
instance_variable_set("@#{base}".intern,
|
70
|
+
value = send("raw_#{base}").try(:strip)
|
71
|
+
error("No #{name} attribute.") unless options[:allow_nil] || value
|
72
|
+
error("Non xs:ID value for the #{name} attribute: #{value}") unless xs_id?(value)
|
73
|
+
instance_variable_set("@#{base}".intern, value)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
alias :idref_attribute :id_attribute
|
@@ -6,17 +6,7 @@ module Scorm2004
|
|
6
6
|
|
7
7
|
# @attribute [r] identifierref
|
8
8
|
# @return [String] The identifierref attribute of <dependency>
|
9
|
-
attribute :
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def do_visit
|
14
|
-
error('Referenced <resource> not found:') unless referenced_resource
|
15
|
-
end
|
16
|
-
|
17
|
-
def referenced_resource
|
18
|
-
@el.at("/imscp:manifest/imscp:resources/imscp:resource[@identifier='#{identifierref}']", NS)
|
19
|
-
end
|
9
|
+
attribute :id, 'identifierref'
|
20
10
|
end
|
21
11
|
end
|
22
12
|
end
|
@@ -52,18 +52,6 @@ module Scorm2004
|
|
52
52
|
# @attribute [r] data
|
53
53
|
# @return [Data, nil] <adlcp:data>
|
54
54
|
has_zero_or_one 'adlcp:data'
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def do_visit
|
59
|
-
if identifierref && resource.nil?
|
60
|
-
error("A <resource> element whose identifier is #{identifierref} not found:")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def resource
|
65
|
-
@el.at("/imscp:manifest/imscp:resources/imscp:resource[@identifier='#{identifierref}']", NS)
|
66
|
-
end
|
67
55
|
end
|
68
56
|
end
|
69
57
|
end
|
@@ -16,12 +16,12 @@ module Scorm2004
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def
|
20
|
-
error('Default <
|
19
|
+
def post_visit
|
20
|
+
error('Default <organization> not found: ' + default) unless default_organization
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def default_organization
|
24
|
+
organizations.find { |org| org.identifier == default }
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -25,7 +25,7 @@ module Scorm2004
|
|
25
25
|
|
26
26
|
# @attribute [r] referenced_objective
|
27
27
|
# @return [String] The +referencedObjective+ attribute of <ruleCondition>
|
28
|
-
attribute :
|
28
|
+
attribute :any_uri, 'referencedObjective', allow_nil: true
|
29
29
|
|
30
30
|
# @attribute [r] measure_threshold
|
31
31
|
# @return [Float] The +measureThreshold+ attribute of <ruleCondition>
|
@@ -33,14 +33,6 @@ module Scorm2004
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
37
|
-
context 'visiting a dependency element with its referencing resource nonexistent' do
|
38
|
-
should 'raise exceptoin' do
|
39
|
-
assert_error do
|
40
|
-
el('<dependency identifierref="k22" />').accept(@v)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
36
|
end
|
45
37
|
|
46
38
|
private
|
@@ -9,6 +9,7 @@ module Scorm2004
|
|
9
9
|
setup do
|
10
10
|
@v = Organizations.new
|
11
11
|
@v.stubs(:organization_visitor).returns(stub(:visit))
|
12
|
+
@v.stubs(:default_organization).returns(:dummy)
|
12
13
|
end
|
13
14
|
|
14
15
|
context 'visiting an organizations element' do
|
@@ -48,6 +49,7 @@ module Scorm2004
|
|
48
49
|
should 'handle XML Base' do
|
49
50
|
@v = Organizations.new(base: Pathname('a/b/c'))
|
50
51
|
@v.stubs(:organization_visitor).returns(stub(:visit))
|
52
|
+
@v.stubs(:default_organization).returns(:dummy)
|
51
53
|
el(<<-XML).accept(@v)
|
52
54
|
<organizations default="t41" xml:base="x/y/z/">
|
53
55
|
<organization identifier="t41" />
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scorm2004-manifest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -277,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
277
277
|
version: '0'
|
278
278
|
segments:
|
279
279
|
- 0
|
280
|
-
hash: -
|
280
|
+
hash: -2026558761935074370
|
281
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
282
|
none: false
|
283
283
|
requirements:
|
@@ -286,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
286
|
version: '0'
|
287
287
|
requirements: []
|
288
288
|
rubyforge_project:
|
289
|
-
rubygems_version: 1.8.
|
289
|
+
rubygems_version: 1.8.23
|
290
290
|
signing_key:
|
291
291
|
specification_version: 3
|
292
292
|
summary: A manifest file parser/validator for SCORM 2004 4th Edition
|