scorm2004-manifest 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/VERSION +1 -1
  2. data/lib/scorm2004/manifest.rb +21 -0
  3. data/lib/scorm2004/manifest/adlseq_map_info.rb +4 -2
  4. data/lib/scorm2004/manifest/adlseq_objective.rb +4 -0
  5. data/lib/scorm2004/manifest/adlseq_objectives.rb +2 -0
  6. data/lib/scorm2004/manifest/completion_threshold.rb +8 -0
  7. data/lib/scorm2004/manifest/condition_rule.rb +5 -0
  8. data/lib/scorm2004/manifest/constrained_choice_considerations.rb +5 -0
  9. data/lib/scorm2004/manifest/control_mode.rb +17 -0
  10. data/lib/scorm2004/manifest/data.rb +2 -0
  11. data/lib/scorm2004/manifest/data_from_lms.rb +3 -5
  12. data/lib/scorm2004/manifest/delivery_controls.rb +8 -0
  13. data/lib/scorm2004/manifest/dependency.rb +2 -0
  14. data/lib/scorm2004/manifest/hide_lmsui.rb +2 -4
  15. data/lib/scorm2004/manifest/href.rb +1 -0
  16. data/lib/scorm2004/manifest/item.rb +34 -0
  17. data/lib/scorm2004/manifest/limit_conditions.rb +5 -0
  18. data/lib/scorm2004/manifest/manifest.rb +14 -0
  19. data/lib/scorm2004/manifest/map.rb +8 -0
  20. data/lib/scorm2004/manifest/map_info.rb +14 -0
  21. data/lib/scorm2004/manifest/min_normalized_measure.rb +1 -0
  22. data/lib/scorm2004/manifest/navigation_interface.rb +2 -0
  23. data/lib/scorm2004/manifest/objective.rb +10 -0
  24. data/lib/scorm2004/manifest/objectives.rb +5 -0
  25. data/lib/scorm2004/manifest/organization.rb +19 -0
  26. data/lib/scorm2004/manifest/organizations.rb +6 -1
  27. data/lib/scorm2004/manifest/presentation.rb +2 -0
  28. data/lib/scorm2004/manifest/primary_objective.rb +5 -0
  29. data/lib/scorm2004/manifest/randomization_controls.rb +11 -0
  30. data/lib/scorm2004/manifest/resource.rb +10 -0
  31. data/lib/scorm2004/manifest/resources.rb +2 -0
  32. data/lib/scorm2004/manifest/rollup_action.rb +2 -0
  33. data/lib/scorm2004/manifest/rollup_condition.rb +5 -0
  34. data/lib/scorm2004/manifest/rollup_conditions.rb +4 -0
  35. data/lib/scorm2004/manifest/rollup_considerations.rb +9 -1
  36. data/lib/scorm2004/manifest/rollup_rule.rb +13 -0
  37. data/lib/scorm2004/manifest/rollup_rules.rb +10 -0
  38. data/lib/scorm2004/manifest/rule_action.rb +2 -0
  39. data/lib/scorm2004/manifest/rule_condition.rb +11 -0
  40. data/lib/scorm2004/manifest/rule_conditions.rb +4 -0
  41. data/lib/scorm2004/manifest/sequencing.rb +34 -0
  42. data/lib/scorm2004/manifest/sequencing_collection.rb +2 -0
  43. data/lib/scorm2004/manifest/sequencing_rules.rb +8 -0
  44. data/lib/scorm2004/manifest/time_limit_action.rb +7 -7
  45. data/test/scorm2004/manifest/data_from_lms_test.rb +1 -1
  46. data/test/scorm2004/manifest/hide_lmsui_test.rb +1 -1
  47. data/test/scorm2004/manifest/time_limit_action_test.rb +1 -1
  48. metadata +53 -18
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 1.0.0
@@ -54,6 +54,18 @@ require 'scorm2004/manifest/adlseq_objective'
54
54
  require 'scorm2004/manifest/adlseq_map_info'
55
55
 
56
56
  module Scorm2004
57
+ # @overload Manifest(manifest_file)
58
+ # Parse and validate a manifest file.
59
+ # Convenience method for Scorm2004::Manifest.parse
60
+ # @param [String, IO] manifest_file manifest_file may be a String,
61
+ # or any object that responds to read and close such as an IO,
62
+ # or StringIO.
63
+ # @return [Scorm2004::Manifest::Manifest]
64
+ # @example Parse and validate a manifest file
65
+ # manifest = Scorm2004::Manifest(open('imsmanifest.xml'))
66
+ # @raise This method raises an instance of Scorm2004::Manifest::Error's
67
+ # subclass if validation fails.
68
+ # @see Scorm2004::Manifest.parse
57
69
  def self.Manifest(*args)
58
70
  Scorm2004::Manifest.parse(*args)
59
71
  end
@@ -67,6 +79,15 @@ module Scorm2004
67
79
  'imsss' => "http://www.imsglobal.org/xsd/imsss"
68
80
  }
69
81
 
82
+ # @overload parse(manifest_file)
83
+ # Parse and validate a manifest file
84
+ # @param [String, IO] manifest_file manifest_file may be a String,
85
+ # or any object that responds to read and close such as an IO,
86
+ # or StringIO.
87
+ # @raise This method raises an instance of Scorm2004::Manifest::Error's
88
+ # subclass if validation fails.
89
+ # @return [Scorm2004::Manifest::Manifest]
90
+ # @see Scorm2004.Manifest
70
91
  def self.parse(*args)
71
92
  manifest_visitor = Scorm2004::Manifest::Manifest.new
72
93
  Nokogiri::XML(*args) { |config| config.strict.noent }.root.accept manifest_visitor
@@ -4,10 +4,12 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] target_objective_id
8
+ # @return [String] The +targetObjectiveID+ attribute of <adlseq:mapInfo>
7
9
  attribute :any_uri, 'targetObjectiveID'
8
10
 
9
- SLOTS = %w( RawScore MinScore MaxScore CompletionStatus ProgressMeasure )
10
- %w( read write ).product(SLOTS).map(&:join).each do |attr|
11
+ elements = %w( RawScore MinScore MaxScore CompletionStatus ProgressMeasure )
12
+ %w( read write ).product(elements).map(&:join).each do |attr|
11
13
  default_value = /^read/ =~ attr ? true : false
12
14
  attribute :boolean, attr, default: default_value
13
15
  end
@@ -5,8 +5,12 @@ module Scorm2004
5
5
  include Children
6
6
  include Attributes
7
7
 
8
+ # @attribute [r] objective_id
9
+ # @return [String] The +objectiveID+ attribute of <adlseq:Objective>
8
10
  attribute :any_uri, 'objectiveID'
9
11
 
12
+ # @attribute [r] adlseq_map_infos
13
+ # @return [Array<AdlseqMapInfo>] <adlseq:mapInfo>
10
14
  has_one_or_more 'adlseq:mapInfo', visitor: :adlseq_map_info
11
15
  end
12
16
  end
@@ -4,6 +4,8 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute [r] adlseq_objectives
8
+ # @return [Array<AdlseqObjective>] <adlseq:objective>
7
9
  has_one_or_more 'adlseq:objective', visitor: :adlseq_objective
8
10
  end
9
11
  end
@@ -4,8 +4,16 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] completed_by_measure
8
+ # @return [Boolean] The +completedByMeasure+ attribute of <completionThreshold>
7
9
  attribute :boolean, 'completedByMeasure', default: false
10
+
11
+ # @attribute [r] min_progress_measure
12
+ # @return [Float] The +minProgressMeasure+ attribute of <completionThreshold>
8
13
  attribute :decimal, 'minProgressMeasure', default: 1.0, range: 0.0..1.0
14
+
15
+ # @attribute [r] progress_weight
16
+ # @return [Float] The +progressWeight+ attribute of <completionThreshold>
9
17
  attribute :decimal, 'progressWeight', default: 1.0, range: 0.0..1.0
10
18
  end
11
19
  end
@@ -4,7 +4,12 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute [r] rule_conditions
8
+ # @return [RuleConditions] <imsss:ruleConditions>
7
9
  has_one_and_only_one 'imsss:ruleConditions'
10
+
11
+ # @attribute [r] rule_action
12
+ # @return [RuleAction] <imsss:ruleAction>
8
13
  has_one_and_only_one 'imsss:ruleAction'
9
14
  end
10
15
  end
@@ -4,7 +4,12 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] prevent_activation
8
+ # @return [Boolean] The +preventActivation+ attribute of <constrainedChoiceConsideration>
7
9
  attribute :boolean, 'preventActivation', default: false
10
+
11
+ # @attribute [r] constrain_choice
12
+ # @return [Boolean] The +constrainChoice+ attribute of <constrainedChoiceConsideration>
8
13
  attribute :boolean, 'constrainChoice', default: false
9
14
  end
10
15
  end
@@ -4,11 +4,28 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] choice
8
+ # @return [Boolean] The +choice+ attribute of <controlMode>
7
9
  attribute :boolean, 'choice', default: true
10
+
11
+ # @attribute [r] choice_exit
12
+ # @return [Boolean] The +choiceExit+ attribute of <controlMode>
8
13
  attribute :boolean, 'choiceExit', default: true
14
+
15
+ # @attribute [r] flow
16
+ # @return [Boolean] The +flow+ attribute of <controlMode>
9
17
  attribute :boolean, 'flow', default: false
18
+
19
+ # @attribute [r] forward_only
20
+ # @return [Boolean] The +forwardOnly+ attribute of <controlMode>
10
21
  attribute :boolean, 'forwardOnly', default: false
22
+
23
+ # @attribute [r] use_current_attempt_objective_info
24
+ # @return [Boolean] The +useCurrentAttemptObjectiveInfo+ attribute of <controlMode>
11
25
  attribute :boolean, 'useCurrentAttemptObjectiveInfo', default: true
26
+
27
+ # @attribute [r] use_current_attempt_progress_info
28
+ # @return [Boolean] The +useCurrentAttemptProgressInfo+ attribute of <controlMode>
12
29
  attribute :boolean, 'useCurrentAttemptProgressInfo', default: true
13
30
  end
14
31
  end
@@ -4,6 +4,8 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute [r] maps
8
+ # @return [Array<Map>] <adlcp:map>
7
9
  has_one_or_more 'adlcp:map'
8
10
  end
9
11
  end
@@ -4,15 +4,13 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include TextNode
6
6
 
7
- def self.spm
8
- 4000
9
- end
7
+ SPM = 4000
10
8
 
11
9
  private
12
10
 
13
11
  def do_visit
14
- if content.length > self.class.spm
15
- error("<adlcp:dataFromLMS> exceeds the SPM of #{self.class.spm}: #{content}")
12
+ if content.length > SPM
13
+ error("<adlcp:dataFromLMS> exceeds the SPM of #{SPM}: #{content}")
16
14
  end
17
15
  end
18
16
  end
@@ -4,8 +4,16 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] tracked
8
+ # @return [Boolean] The +tracked+ attribute of <deliveryControls>
7
9
  attribute :boolean, 'tracked', default: true
10
+
11
+ # @attribute [r] completion_set_by_content
12
+ # @return [Boolean] The +completion_set_by_content+ attribute of <deliveryControls>
8
13
  attribute :boolean, 'completionSetByContent', default: false
14
+
15
+ # @attribute [r] objective_set_by_content
16
+ # @return [Boolean] The +objective_set_by_content+ attribute of <deliveryControls>
9
17
  attribute :boolean, 'objectiveSetByContent', default: false
10
18
  end
11
19
  end
@@ -4,6 +4,8 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] identifierref
8
+ # @return [String] The identifierref attribute of <dependency>
7
9
  attribute :string, 'identifierref'
8
10
 
9
11
  private
@@ -4,14 +4,12 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include TextNode
6
6
 
7
- def self.vocabulary
8
- %w( previous continue exit exitAll abandon abandonAll suspendAll )
9
- end
7
+ VOCABULARY = %w( previous continue exit exitAll abandon abandonAll suspendAll )
10
8
 
11
9
  private
12
10
 
13
11
  def do_visit
14
- unless self.class.vocabulary.include?(content)
12
+ unless VOCABULARY.include?(content)
15
13
  error("Invalid <adlnav:hideLMSUI> token: #{content}")
16
14
  end
17
15
  end
@@ -1,6 +1,7 @@
1
1
  module Scorm2004
2
2
  module Manifest
3
3
  module Href
4
+ # @return [String] The +href+ to which all +xml:base+ attributes have been applied
4
5
  def href
5
6
  (base ? resolve_href : relative_href).try(:to_s)
6
7
  end
@@ -5,18 +5,52 @@ module Scorm2004
5
5
  include Children
6
6
  include Attributes
7
7
 
8
+ # @attribute [r] identifier
9
+ # @return [String] The +identifier+ attribute of <item>
8
10
  attribute :id, 'identifier'
11
+
12
+ # @attribute [r] identifierref
13
+ # @return [String] The +identifierref+ attribute of <item>
9
14
  attribute :string, 'identifierref', allow_nil: true
15
+
16
+ # @attribute [r] isvisible
17
+ # @return [Boolean] The +isvisible+ attribute of <item>
10
18
  attribute :boolean, 'isvisible', default: true
19
+
20
+ # @attribute [r] parameters
21
+ # @return [String] The +parameters+ attribute of <item>
11
22
  attribute :string, 'parameters', allow_nil: true
12
23
 
24
+ # @attribute [r] title
25
+ # @return [Title] <title>
13
26
  has_one_and_only_one 'imscp:title'
27
+
28
+ # @attribute [r] item
29
+ # @return [Array<Item>] <item>
14
30
  has_zero_or_more 'imscp:item'
31
+
32
+ # @attribute [r] time_limit_action
33
+ # @return [TimeLimitAction, nil] <adlcp:timeLimitAction>
15
34
  has_zero_or_one 'adlcp:timeLimitAction'
35
+
36
+ # @attribute [r] data_from_lms
37
+ # @return [DataFromLms, nil] <adlcp:dataFromLMS>
16
38
  has_zero_or_one 'adlcp:dataFromLMS'
39
+
40
+ # @attribute [r] completion_threshold
41
+ # @return [CompletionThreshold, nil] <adlcp:completionThreshold>
17
42
  has_zero_or_one 'adlcp:completionThreshold'
43
+
44
+ # @attribute [r] sequencing
45
+ # @return [Sequencing, nil] <imsss:sequencing>
18
46
  has_zero_or_one 'imsss:sequencing'
47
+
48
+ # @attribute [r] presentation
49
+ # @return [Presentation, nil] <adlnav:presentation>
19
50
  has_zero_or_one 'adlnav:presentation'
51
+
52
+ # @attribute [r] data
53
+ # @return [Data, nil] <adlcp:data>
20
54
  has_zero_or_one 'adlcp:data'
21
55
 
22
56
  private
@@ -4,7 +4,12 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] attempt_limit
8
+ # @return [Fixnum] The +attemptLimit+ attribute of <limitConditions>
7
9
  attribute :non_negative_integer, 'attemptLimit', allow_nil: true
10
+
11
+ # @attribute [r] attempt_absolute_duration_limit
12
+ # @return [String] The +attemptAbsoluteDurationLimit+ attribute of <limitConditions>
8
13
  attribute :duration, 'attemptAbsoluteDurationLimit', allow_nil: true
9
14
  end
10
15
  end
@@ -10,11 +10,25 @@ module Scorm2004
10
10
 
11
11
  has_one_and_only_one './imscp:metadata/imscp:schema'
12
12
  has_one_and_only_one './imscp:metadata/imscp:schemaversion'
13
+
14
+ # @attribute [r] resources
15
+ # @return [Resources] <resources>
13
16
  has_one_and_only_one 'imscp:resources'
17
+
18
+ # @attribute [r] organizations
19
+ # @return [Organizations] <organizations>
14
20
  has_one_and_only_one 'imscp:organizations'
21
+
22
+ # @attribute [r] sequencing_collection
23
+ # @return [SequencingCollection, nil] <imsss:sequencingCollection>
15
24
  has_zero_or_one 'imsss:sequencingCollection'
16
25
 
26
+ # @attribute [r] identifier
27
+ # @return [String] The identifier attribute of <manifest>
17
28
  attribute :id, 'identifier'
29
+
30
+ # @attribute [r] version
31
+ # @return [String] The version attribute of <manifest>
18
32
  attribute :string, 'version', spm: VERSION_SPM
19
33
  end
20
34
  end
@@ -4,8 +4,16 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] target_id
8
+ # @return [String] The +targetID+ attribute of <map>
7
9
  attribute :any_uri, 'targetID'
10
+
11
+ # @attribute [r] read_shared_data
12
+ # @return [Boolean] The +readSharedData+ attribute of <map>
8
13
  attribute :boolean, 'readSharedData', default: true
14
+
15
+ # @attribute [r] write_shared_data
16
+ # @return [Boolean] The +writeSharedData+ attribute of <map>
9
17
  attribute :boolean, 'writeSharedData', default: true
10
18
  end
11
19
  end
@@ -4,10 +4,24 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Attributes
6
6
 
7
+ # @attribute [r] target_objective_id
8
+ # @return [String] The +targetObjectiveID+ attribute of <mapinfo>
7
9
  attribute :any_uri, 'targetObjectiveID'
10
+
11
+ # @attribute [r] read_satisfied_status
12
+ # @return [Boolean] The +readSatisfiedStatus+ attribute of <mapInfo>
8
13
  attribute :boolean, 'readSatisfiedStatus', default: true
14
+
15
+ # @attribute [r] read_normalized_measure
16
+ # @return [Boolean] The +readNormalizedMeasure+ attribute of <mapInfo>
9
17
  attribute :boolean, 'readNormalizedMeasure', default: true
18
+
19
+ # @attribute [r] write_satisfied_status
20
+ # @return [Boolean] The +writeSatisfiedStatus+ attribute of <mapInfo>
10
21
  attribute :boolean, 'writeSatisfiedStatus', default: false
22
+
23
+ # @attribute [r] write_normalized_measure
24
+ # @return [Boolean] The +writeNormalizedMeasure+ attribute of <mapInfo>
11
25
  attribute :boolean, 'writeNormalizedMeasure', default: false
12
26
  end
13
27
  end
@@ -3,6 +3,7 @@ module Scorm2004
3
3
  class MinNormalizedMeasure
4
4
  include VisitorPattern
5
5
 
6
+ # @return [Float] The value of <minNormalizedMeasure>
6
7
  def to_f
7
8
  Float(@el.content)
8
9
  end
@@ -4,6 +4,8 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute [r] hide_lmsuis
8
+ # @return [Array<HideLmsui>] <adlnav:hideLMSUI>
7
9
  has_zero_or_more 'adlnav:hideLMSUI'
8
10
  end
9
11
  end
@@ -5,10 +5,20 @@ module Scorm2004
5
5
  include Children
6
6
  include Attributes
7
7
 
8
+ # @attribute [r] satisfied_by_measure
9
+ # @return [Boolean] The +satisfiedByMeasure+ attribute of <objective>
8
10
  attribute :boolean, 'satisfiedByMeasure', default: false
11
+
12
+ # @attribute [r] objective_id
13
+ # @return [String] The +objectiveID+ attribute of <objective>
9
14
  attribute :any_uri, 'objectiveID'
10
15
 
16
+ # @attribute [r] min_normalized_measure
17
+ # @return [MinNormalizedMeasure, nil] <imsss:minNormalizedMeasure>
11
18
  has_zero_or_one 'imsss:minNormalizedMeasure'
19
+
20
+ # @attribute [r] map_infos
21
+ # @return [Array<MapInfo>] <imsss:mapInfo>
12
22
  has_zero_or_more 'imsss:mapInfo'
13
23
  end
14
24
  end
@@ -4,7 +4,12 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute [r] primary_objective
8
+ # @return [PrimaryObjective] <imsss:primaryObjective>
7
9
  has_one_and_only_one 'imsss:primaryObjective'
10
+
11
+ # @attribute [r] objectives
12
+ # @return [Array<Objective>] <imsss:objective>
8
13
  has_zero_or_more 'imsss:objective'
9
14
  end
10
15
  end
@@ -6,13 +6,32 @@ module Scorm2004
6
6
  include Attributes
7
7
  include XmlBase
8
8
 
9
+ # @attribute [r] items
10
+ # @return [Array<Item>] <item>
9
11
  has_one_or_more 'imscp:item'
12
+
13
+ # @attribute [r] title
14
+ # @return [Title] <title>
10
15
  has_one_and_only_one 'imscp:title'
16
+
17
+ # @attribute [r] completion_threshold
18
+ # @return [CompletionThreshold, nil] <adlcp:completionThrehsold>
11
19
  has_zero_or_one 'adlcp:completionThreshold'
20
+
21
+ # @attribute [r] sequencing
22
+ # @return [Sequencing, nil] <imsss:sequencing>
12
23
  has_zero_or_one 'imsss:sequencing'
13
24
 
25
+ # @attribute [r] identifier
26
+ # @return [String] The identifier attribute of <organization>
14
27
  attribute :id, 'identifier'
28
+
29
+ # @attribute [r] objectives_global_to_system
30
+ # @return [Boolean] The adlseq:objectivesGlobalToSystem attribute of <organization>
15
31
  attribute :boolean, 'adlseq:objectivesGlobalToSystem', default: false
32
+
33
+ # @attribute [r] shared_data_global_to_system
34
+ # @return [Boolean] The adlcp:sharedDataGlobalToSystem attribute of <organization>
16
35
  attribute :boolean, 'adlcp:sharedDataGlobalToSystem', default: false
17
36
  end
18
37
  end
@@ -6,13 +6,18 @@ module Scorm2004
6
6
  include Attributes
7
7
  include XmlBase
8
8
 
9
+ # @attribute [r] default
10
+ # @return [String] The default attribute of <organizations>
9
11
  attribute :idref, 'default'
12
+
13
+ # @attribute [r] organizations
14
+ # @return [Array<Organization>] <organization>
10
15
  has_one_or_more 'imscp:organization'
11
16
 
12
17
  private
13
18
 
14
19
  def do_visit
15
- error('Default <resource> not foulnd: ' + default) unless default_resource
20
+ error('Default <resource> not found: ' + default) unless default_resource
16
21
  end
17
22
 
18
23
  def default_resource
@@ -4,6 +4,8 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute [r] navigation_interface
8
+ # @return [NavigationInterface, nil] <adlnav:navigationInterface>
7
9
  has_zero_or_one 'adlnav:navigationInterface'
8
10
  end
9
11
  end
@@ -8,7 +8,12 @@ module Scorm2004
8
8
  attribute :boolean, 'satisfiedByMeasure', default: false
9
9
  attribute :any_uri, 'objectiveID', allow_nil: true
10
10
 
11
+ # @attribute [r] min_normalized_measure
12
+ # @return [MinNormalizedMeasure, nil] <imsss:minNormalizedMeasure>
11
13
  has_zero_or_one 'imsss:minNormalizedMeasure'
14
+
15
+ # @attribute [r] map_infos
16
+ # @return [Array<MapInfo>] <imsss:mapInfo>
12
17
  has_zero_or_more 'imsss:mapInfo'
13
18
 
14
19
  private
@@ -6,9 +6,20 @@ module Scorm2004
6
6
 
7
7
  TIMINGS = %w( never once onEachNewAttempt )
8
8
 
9
+ # @attribute [r] randomization_timing
10
+ # @return [String] The +randomizationTiming+ attribute of <randomizationControls>
9
11
  attribute :token, 'randomizationTiming', vocabulary: TIMINGS, default: 'never'
12
+
13
+ # @attribute [r] select_count
14
+ # @return [Fixnum] The +selectCount+ attribute of <randomizationControls>
10
15
  attribute :non_negative_integer, 'selectCount', allow_nil: true
16
+
17
+ # @attribute [r] reorder_children
18
+ # @return [Boolean] The +reorderChildren+ attribute of <randomizationControls>
11
19
  attribute :boolean, 'reorderChildren', default: false
20
+
21
+ # @attribute [r] selection_timing
22
+ # @return [String] The +selectionTiming+ attribute of <randomizationControls>
12
23
  attribute :token, 'selectionTiming', vocabulary: TIMINGS, default: 'never'
13
24
  end
14
25
  end
@@ -7,10 +7,20 @@ module Scorm2004
7
7
  include XmlBase
8
8
  include Href
9
9
 
10
+ # @attribute [r] identifier
11
+ # @return [String] The identifier attribute of <resource>
10
12
  attribute :id, 'identifier'
13
+
14
+ # @attribute [r] scorm_type
15
+ # @return [String] The adlcp:scormType attribute of <resource>, +sco+ or +asset+
11
16
  attribute :token, 'adlcp:scormType', vocabulary: %w( sco asset )
12
17
 
18
+ # @attribute [r] files
19
+ # @return [Array<File>] <file>
13
20
  has_zero_or_more 'imscp:file'
21
+
22
+ # @attribute [r] dependencies
23
+ # @return [Array<Dependency>] <dependency>
14
24
  has_zero_or_more 'imscp:dependency'
15
25
  end
16
26
  end
@@ -5,6 +5,8 @@ module Scorm2004
5
5
  include Children
6
6
  include XmlBase
7
7
 
8
+ # @attribute [r] resources
9
+ # @return [Array<Resource>] <resource>
8
10
  has_zero_or_more 'imscp:resource'
9
11
  end
10
12
  end
@@ -6,6 +6,8 @@ module Scorm2004
6
6
 
7
7
  ACTIONS = %w( satisfied notSatisfied completed incomplete )
8
8
 
9
+ # @attribute [r] action
10
+ # @return [String] The +action+ attribute of <rollupAction>
9
11
  attribute :token, 'action', vocabulary: ACTIONS
10
12
  end
11
13
  end
@@ -16,7 +16,12 @@ module Scorm2004
16
16
  'outsideAvailableTimeRange'
17
17
  ]
18
18
 
19
+ # @attribute [r] operator
20
+ # @return [String] The +operator+ attribute of <rollupCondition>
19
21
  attribute :token, 'operator', vocabulary: %w( not noOp ), default: 'noOp'
22
+
23
+ # @attribute [r] condition
24
+ # @return [String] The +condition+ attribute of <rollupCondition>
20
25
  attribute :token, 'condition', vocabulary: CONDITIONS
21
26
  end
22
27
  end
@@ -5,8 +5,12 @@ module Scorm2004
5
5
  include Children
6
6
  include Attributes
7
7
 
8
+ # @attribute [r] condition_combination
9
+ # @return [String] The +conditionCombination+ attribute of <rollupConditions>
8
10
  attribute :token, 'conditionCombination', vocabulary: %w( any all ), default: 'any'
9
11
 
12
+ # @attribute [r] rollup_conditions
13
+ # @return [Array<RollupCondition>] <imsss:rollupCondition>
10
14
  has_one_or_more 'imsss:rollupCondition'
11
15
  end
12
16
  end
@@ -5,11 +5,19 @@ module Scorm2004
5
5
  include Attributes
6
6
 
7
7
  CONDITIONS = %w( always ifAttempted ifNotSkipped ifNotSuspended )
8
+ ATTRIBUTES = [
9
+ 'requiredForSatisfied',
10
+ 'requireForNotSatisfied',
11
+ 'requiredForCompleted',
12
+ 'requireForIncomplete'
13
+ ]
8
14
 
9
- %w( requiredForSatisfied requireForNotSatisfied requiredForCompleted requireForIncomplete ).each do |attr|
15
+ ATTRIBUTES.each do |attr|
10
16
  attribute :token, attr, vocabulary: CONDITIONS, default: CONDITIONS.first
11
17
  end
12
18
 
19
+ # @attribute [r] measure_satisfaction_if_active
20
+ # @return [Boolean] The +measureSatisfactionIfActive+ attribute of <rollupConsideration>
13
21
  attribute :boolean, 'measureSatisfactionIfActive', default: true
14
22
  end
15
23
  end
@@ -7,11 +7,24 @@ module Scorm2004
7
7
 
8
8
  CONDITIONS = %w( all any none atLeastCount atLeastPercent )
9
9
 
10
+ # @attribute [r] child_activity_set
11
+ # @return [String] The +childActivitySet+ of <rollupRule>
10
12
  attribute :token, 'childActivitySet', vocabulary: CONDITIONS, default: CONDITIONS.first
13
+
14
+ # @attribute [r] minimum_count
15
+ # @return [Fixnum] The +minimumCount+ attribute of <rollupRule>
11
16
  attribute :non_negative_integer, 'minimumCount', default: 0
17
+
18
+ # @attribute [r] minimum_percent
19
+ # @return [Float] The +minimumPercent+ attribute of <rollupRule>
12
20
  attribute :decimal, 'minimumPercent', range: 0.0..1.0, default: 0.0
13
21
 
22
+ # @attribute [r] rollup_conditions
23
+ # @return [RollupConditions] <imsss:rollupConditions>
14
24
  has_one_and_only_one 'imsss:rollupConditions'
25
+
26
+ # @attribute [r] rollup_action
27
+ # @return [RollupAction] <imsss:rollupAction>
15
28
  has_one_and_only_one 'imsss:rollupAction'
16
29
  end
17
30
  end
@@ -5,10 +5,20 @@ module Scorm2004
5
5
  include Children
6
6
  include Attributes
7
7
 
8
+ # @attribute [r] rollup_objective_satisfied
9
+ # @return [Boolean] The +rollupObjectiveSatisfied+ attribute of <rollupRules>
8
10
  attribute :boolean, 'rollupObjectiveSatisfied', default: true
11
+
12
+ # @attribute [r] rollup_progress_completion
13
+ # @return [Boolean] The +rollupProgressCompletion+ attribute of <rollupRules>
9
14
  attribute :boolean, 'rollupProgressCompletion', default: true
15
+
16
+ # @attribute [r] objective_measure_weight
17
+ # @return [Float] The +objectiveMeasureWeight+ attribute of <rollupRules>
10
18
  attribute :decimal, 'objectiveMeasureWeight', range: 0.0..1.0, default: 1.0
11
19
 
20
+ # @attribute [r] rollup_rules
21
+ # @return [Array<RollupRule>] <imsss:rollupRule>
12
22
  has_zero_or_more 'imsss:rollupRule'
13
23
  end
14
24
  end
@@ -8,6 +8,8 @@ module Scorm2004
8
8
  POST = %w( exitParent exitAll retry retryAll continue previous )
9
9
  EXIT = %w( exit )
10
10
 
11
+ # @attribute [r] action
12
+ # @return [String] The +action+ attribute of <ruleAction>
11
13
  attribute :token, 'action', vocabulary: PRE + POST + EXIT
12
14
 
13
15
  private
@@ -19,9 +19,20 @@ module Scorm2004
19
19
  'always'
20
20
  ]
21
21
 
22
+ # @attribute [r] operator
23
+ # @return [String] The +operator+ attribute of <ruleCondition>
22
24
  attribute :token, 'operator', vocabulary: %w( not noOp ), default: 'noOp'
25
+
26
+ # @attribute [r] referenced_objective
27
+ # @return [String] The +referencedObjective+ attribute of <ruleCondition>
23
28
  attribute :string, 'referencedObjective', allow_nil: true
29
+
30
+ # @attribute [r] measure_threshold
31
+ # @return [Float] The +measureThreshold+ attribute of <ruleCondition>
24
32
  attribute :decimal, 'measureThreshold', range: -1.0..1.0, allow_nil: true
33
+
34
+ # @attribute [r] condition
35
+ # @return [String] The +condition+ attribute of <ruleCondition>
25
36
  attribute :token, 'condition', vocabulary: CONDITIONS
26
37
 
27
38
  private
@@ -5,8 +5,12 @@ module Scorm2004
5
5
  include Children
6
6
  include Attributes
7
7
 
8
+ # @attribute [r] condition_combination
9
+ # @return [String] The +conditionCombination+ attribute of <ruleConditions>
8
10
  attribute :token, 'conditionCombination', vocabulary: %w( all any ), default: 'all'
9
11
 
12
+ # @attribute [r] rule_conditions
13
+ # @return [Array<RuleCondition>] <imsss:ruleCondition>
10
14
  has_one_or_more 'imsss:ruleCondition'
11
15
  end
12
16
  end
@@ -5,18 +5,52 @@ module Scorm2004
5
5
  include Children
6
6
  include Attributes
7
7
 
8
+ # @attribute [r] id
9
+ # @return [String] The +ID+ attribute of <sequencing>
8
10
  attribute :id, 'ID', allow_nil: true
11
+
12
+ # @attribute [r] idref
13
+ # @return [String] The +IDRef+ attribute of <sequencing>
9
14
  attribute :idref, 'IDRef', allow_nil: true
10
15
 
16
+ # @attribute [r] control_mode
17
+ # @return [ControlMode, nil] <imsss:controlMode>
11
18
  has_zero_or_one 'imsss:controlMode'
19
+
20
+ # @attribute [r] sequencing_rules
21
+ # @return [SequencingRules, nil] <imsss:sequencingRules>
12
22
  has_zero_or_one 'imsss:sequencingRules'
23
+
24
+ # @attribute [r] limit_conditions
25
+ # @return [LimitConditions, nil] <imsss:limitConditions>
13
26
  has_zero_or_one 'imsss:limitConditions'
27
+
28
+ # @attribute [r] rollup_rules
29
+ # @return [RollupRules, nil] <imsss:rollupRules>
14
30
  has_zero_or_one 'imsss:rollupRules'
31
+
32
+ # @attribute [r] objectives
33
+ # @return [Objectives, nil] <imsss:objectives>
15
34
  has_zero_or_one 'imsss:objectives'
35
+
36
+ # @attribute [r] randomization_controls
37
+ # @return [RandomizationControls, nil] <imsss:randomizationControls>
16
38
  has_zero_or_one 'imsss:randomizationControls'
39
+
40
+ # @attribute [r] delivery_controls
41
+ # @return [DeliveryControls, nil] <imsss:deliveryControls>
17
42
  has_zero_or_one 'imsss:deliveryControls'
43
+
44
+ # @attribute [r] constrained_choice_considerations
45
+ # @return [ConstrainedChoiceConsiderations, nil] <imsss:constrainedChoiceConsiderations>
18
46
  has_zero_or_one 'adlseq:constrainedChoiceConsiderations'
47
+
48
+ # @attribute [r] rollup_considerations
49
+ # @return [RollupConsiderations, nil] <adlseq:rollupConsiderations>
19
50
  has_zero_or_one 'adlseq:rollupConsiderations'
51
+
52
+ # @attribute [r] adlseq_objectives
53
+ # @return [AdlseqObjectives, nil] <adlseq:objectives>
20
54
  has_zero_or_one 'adlseq:objectives', name: 'adlseq_objectives', visitor: :adlseq_objectives
21
55
  end
22
56
  end
@@ -4,6 +4,8 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute sequencings
8
+ # @return [Array<Sequencing>] <imsss:sequencing>
7
9
  has_one_or_more 'imsss:sequencing'
8
10
  end
9
11
  end
@@ -4,8 +4,16 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include Children
6
6
 
7
+ # @attribute pre_condition_rules
8
+ # @return [Array<ConditionRule>] <imsss:preConditionRule>
7
9
  has_zero_or_more 'imsss:preConditionRule', visitor: :condition_rule
10
+
11
+ # @attribute post_condition_rule
12
+ # @return [Array<ConditionRule>] <imsss:postConditionRule>
8
13
  has_zero_or_more 'imsss:postConditionRule', visitor: :condition_rule
14
+
15
+ # @attribute exit_condition_rule
16
+ # @return [Array<ConditionRule>] <imsss:exitConditionRule>
9
17
  has_zero_or_more 'imsss:exitConditionRule', visitor: :condition_rule
10
18
  end
11
19
  end
@@ -4,17 +4,17 @@ module Scorm2004
4
4
  include VisitorPattern
5
5
  include TextNode
6
6
 
7
- def self.vocabulary
8
- [ 'exit, message',
9
- 'exit,no message',
10
- 'continue, message',
11
- 'continue,no message' ]
12
- end
7
+ VOCABULARY = [
8
+ 'exit, message',
9
+ 'exit,no message',
10
+ 'continue, message',
11
+ 'continue,no message'
12
+ ]
13
13
 
14
14
  private
15
15
 
16
16
  def do_visit
17
- unless self.class.vocabulary.include?(content)
17
+ unless VOCABULARY.include?(content)
18
18
  error("Invalid <adlcp:timeLimitAction> token: #{content}")
19
19
  end
20
20
  end
@@ -37,7 +37,7 @@ module Scorm2004
37
37
  context 'visitng an element whose content is too large' do
38
38
  should 'raise exception' do
39
39
  assert_raise DataFromLms::Error do
40
- el('<dummy>' + 'x' * (DataFromLms.spm + 1) + '</dummy>').accept(@v)
40
+ el('<dummy>' + 'x' * (DataFromLms::SPM + 1) + '</dummy>').accept(@v)
41
41
  end
42
42
  end
43
43
  end
@@ -9,7 +9,7 @@ module Scorm2004
9
9
  @v = HideLmsui.new
10
10
  end
11
11
 
12
- HideLmsui.vocabulary.each do |token|
12
+ HideLmsui::VOCABULARY.each do |token|
13
13
  tag ="<adlnav:hideLMSUI>#{token}</adlnav:hideLMSUI>"
14
14
  test tag do
15
15
  el(tag).accept(@v)
@@ -19,7 +19,7 @@ module Scorm2004
19
19
  end
20
20
  end
21
21
 
22
- TimeLimitAction.vocabulary.each do |token|
22
+ TimeLimitAction::VOCABULARY.each do |token|
23
23
  test "<adlcp:timeLimitAction>#{token}</adlcp:timieLimitAction>" do
24
24
  assert_nothing_raised do
25
25
  el("<dummy>#{token}</dummy").accept(@v)
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: 0.2.0
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-17 00:00:00.000000000 Z
12
+ date: 2012-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &2159964920 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2159964920
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: activesupport
27
- requirement: &2159963820 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *2159963820
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: shoulda-context
38
- requirement: &2159963000 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '1.0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2159963000
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: mocha
49
- requirement: &2159985660 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 0.10.4
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *2159985660
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.10.4
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: yard
60
- requirement: &2159985180 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0.7'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *2159985180
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '0.7'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: bundler
71
- requirement: &2159984700 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: 1.1.0
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *2159984700
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.1.0
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: jeweler
82
- requirement: &2159984060 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ~>
@@ -87,7 +117,12 @@ dependencies:
87
117
  version: 1.8.3
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *2159984060
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.8.3
91
126
  description: ! 'scorm2004-manifest is a Ruby gem that provides a manifest file parser
92
127
  for SCORM 2004 4th edition. It parses and validates the manifest file according
93
128
  to SCORM 2004 4th Edition Content Aggregation Model (CAM) Version 1.1. After parsing
@@ -242,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
277
  version: '0'
243
278
  segments:
244
279
  - 0
245
- hash: 3400129364290875966
280
+ hash: -157757132896305828
246
281
  required_rubygems_version: !ruby/object:Gem::Requirement
247
282
  none: false
248
283
  requirements:
@@ -251,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
286
  version: '0'
252
287
  requirements: []
253
288
  rubyforge_project:
254
- rubygems_version: 1.8.17
289
+ rubygems_version: 1.8.20
255
290
  signing_key:
256
291
  specification_version: 3
257
292
  summary: A manifest file parser/validator for SCORM 2004 4th Edition