active-fedora 6.7.8 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +1 -0
  4. data/.rubocop_todo.yml +938 -0
  5. data/.travis.yml +5 -6
  6. data/Gemfile +3 -1
  7. data/Rakefile +7 -5
  8. data/active-fedora.gemspec +7 -8
  9. data/lib/active_fedora/om_datastream.rb +1 -0
  10. data/lib/active_fedora/rdf_xml_writer.rb +31 -62
  11. data/lib/active_fedora/version.rb +1 -1
  12. data/spec/config_helper.rb +14 -14
  13. data/spec/integration/associations_spec.rb +232 -232
  14. data/spec/integration/attributes_spec.rb +11 -12
  15. data/spec/integration/auditable_spec.rb +10 -10
  16. data/spec/integration/base_spec.rb +163 -163
  17. data/spec/integration/bug_spec.rb +7 -7
  18. data/spec/integration/complex_rdf_datastream_spec.rb +88 -88
  19. data/spec/integration/datastream_collections_spec.rb +69 -69
  20. data/spec/integration/datastream_spec.rb +43 -43
  21. data/spec/integration/datastreams_spec.rb +63 -63
  22. data/spec/integration/delegating_spec.rb +14 -14
  23. data/spec/integration/delete_all_spec.rb +38 -42
  24. data/spec/integration/fedora_solr_sync_spec.rb +5 -5
  25. data/spec/integration/full_featured_model_spec.rb +101 -101
  26. data/spec/integration/has_many_associations_spec.rb +24 -24
  27. data/spec/integration/model_spec.rb +30 -30
  28. data/spec/integration/nested_attribute_spec.rb +41 -41
  29. data/spec/integration/ntriples_datastream_spec.rb +107 -107
  30. data/spec/integration/om_datastream_spec.rb +67 -67
  31. data/spec/integration/persistence_spec.rb +6 -6
  32. data/spec/integration/rdf_nested_attributes_spec.rb +56 -56
  33. data/spec/integration/relation_delegation_spec.rb +24 -26
  34. data/spec/integration/rels_ext_datastream_spec.rb +20 -20
  35. data/spec/integration/scoped_query_spec.rb +40 -41
  36. data/spec/integration/solr_instance_loader_spec.rb +4 -4
  37. data/spec/integration/solr_service_spec.rb +46 -46
  38. data/spec/rails3_test_app/config/application.rb +1 -1
  39. data/spec/rails3_test_app/config/environments/development.rb +0 -1
  40. data/spec/rails3_test_app/config/environments/production.rb +1 -1
  41. data/spec/rails3_test_app/spec/spec_helper.rb +3 -3
  42. data/spec/rails3_test_app/spec/unit/rails_3_init.rb +4 -4
  43. data/spec/samples/hydra-mods_article_datastream.rb +334 -334
  44. data/spec/samples/hydra-rights_metadata_datastream.rb +57 -57
  45. data/spec/samples/marpa-dc_datastream.rb +17 -17
  46. data/spec/samples/models/audio_record.rb +16 -16
  47. data/spec/samples/models/image.rb +2 -2
  48. data/spec/samples/models/mods_article.rb +5 -5
  49. data/spec/samples/models/oral_history.rb +18 -18
  50. data/spec/samples/models/seminar.rb +24 -24
  51. data/spec/samples/models/seminar_audio_file.rb +17 -17
  52. data/spec/samples/oral_history_sample_model.rb +21 -21
  53. data/spec/samples/special_thing.rb +14 -14
  54. data/spec/spec_helper.rb +7 -11
  55. data/spec/support/an_active_model.rb +2 -2
  56. data/spec/support/mock_fedora.rb +16 -17
  57. data/spec/unit/active_fedora_spec.rb +58 -58
  58. data/spec/unit/association_proxy_spec.rb +5 -7
  59. data/spec/unit/base_active_model_spec.rb +25 -26
  60. data/spec/unit/base_cma_spec.rb +5 -5
  61. data/spec/unit/base_datastream_management_spec.rb +27 -27
  62. data/spec/unit/base_delegate_spec.rb +80 -82
  63. data/spec/unit/base_delegate_to_spec.rb +37 -39
  64. data/spec/unit/base_extra_spec.rb +48 -48
  65. data/spec/unit/base_spec.rb +300 -300
  66. data/spec/unit/callback_spec.rb +19 -19
  67. data/spec/unit/code_configurator_spec.rb +17 -17
  68. data/spec/unit/config_spec.rb +16 -8
  69. data/spec/unit/content_model_spec.rb +60 -60
  70. data/spec/unit/datastream_collections_spec.rb +229 -229
  71. data/spec/unit/datastream_spec.rb +57 -54
  72. data/spec/unit/datastreams_spec.rb +77 -77
  73. data/spec/unit/file_configurator_spec.rb +217 -217
  74. data/spec/unit/has_and_belongs_to_many_collection_spec.rb +26 -26
  75. data/spec/unit/has_many_collection_spec.rb +9 -9
  76. data/spec/unit/inheritance_spec.rb +12 -13
  77. data/spec/unit/model_spec.rb +41 -51
  78. data/spec/unit/nom_datastream_spec.rb +15 -15
  79. data/spec/unit/ntriples_datastream_spec.rb +112 -112
  80. data/spec/unit/om_datastream_spec.rb +233 -227
  81. data/spec/unit/persistence_spec.rb +6 -6
  82. data/spec/unit/predicates_spec.rb +73 -73
  83. data/spec/unit/property_spec.rb +9 -17
  84. data/spec/unit/qualified_dublin_core_datastream_spec.rb +33 -33
  85. data/spec/unit/query_spec.rb +188 -217
  86. data/spec/unit/rdf_datastream_spec.rb +28 -21
  87. data/spec/unit/rdf_list_nested_attributes_spec.rb +34 -34
  88. data/spec/unit/rdf_list_spec.rb +80 -104
  89. data/spec/unit/rdf_node_spec.rb +7 -7
  90. data/spec/unit/rdf_xml_writer_spec.rb +10 -10
  91. data/spec/unit/rdfxml_rdf_datastream_spec.rb +27 -27
  92. data/spec/unit/relationship_graph_spec.rb +51 -51
  93. data/spec/unit/rels_ext_datastream_spec.rb +75 -69
  94. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +15 -15
  95. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +15 -15
  96. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +15 -15
  97. data/spec/unit/rspec_matchers/match_fedora_datastream_matcher_spec.rb +12 -12
  98. data/spec/unit/rubydora_connection_spec.rb +5 -5
  99. data/spec/unit/semantic_node_spec.rb +59 -59
  100. data/spec/unit/serializers_spec.rb +4 -4
  101. data/spec/unit/service_definitions_spec.rb +26 -26
  102. data/spec/unit/simple_datastream_spec.rb +17 -17
  103. data/spec/unit/solr_config_options_spec.rb +27 -28
  104. data/spec/unit/solr_digital_object_spec.rb +21 -21
  105. data/spec/unit/solr_service_spec.rb +81 -81
  106. data/spec/unit/unsaved_digital_object_spec.rb +20 -20
  107. data/spec/unit/validations_spec.rb +21 -21
  108. metadata +70 -58
  109. data/gemfiles/gemfile.rails3 +0 -11
  110. data/gemfiles/gemfile.rails4 +0 -10
@@ -12,81 +12,81 @@ module Hydra
12
12
  #
13
13
  # Another interesting thing in this Class: it extends to_solr, first calling "super" (the default to_solr behavior) and then inserting an additional embargo_release_date_dt field
14
14
  # It uses Solrizer::Extractor.insert_solr_field_value to do this. That method handles inserting new values into a Hash while ensuring that you don't destroy or overwrite any existing values in the hash.
15
- class RightsMetadataDatastream < ActiveFedora::OmDatastream
16
-
15
+ class RightsMetadataDatastream < ActiveFedora::OmDatastream
16
+
17
17
  set_terminology do |t|
18
- t.root(:path=>"rightsMetadata", :xmlns=>"http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd")
18
+ t.root(:path => 'rightsMetadata', :xmlns => 'http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1', :schema => 'http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd')
19
19
  t.copyright {
20
20
  t.machine {
21
- t.cclicense
21
+ t.cclicense
22
22
  }
23
- t.human_readable(:path=>"human")
24
- t.cclicense(:proxy=>[:machine, :cclicense ])
23
+ t.human_readable(:path => 'human')
24
+ t.cclicense(:proxy => [:machine, :cclicense ])
25
25
  }
26
26
  t.access {
27
- t.human_readable(:path=>"human")
27
+ t.human_readable(:path => 'human')
28
28
  t.machine {
29
29
  t.group
30
30
  t.person
31
31
  }
32
- t.person(:proxy=>[:machine, :person])
33
- t.group(:proxy=>[:machine, :group])
32
+ t.person(:proxy => [:machine, :person])
33
+ t.group(:proxy => [:machine, :group])
34
34
  # accessor :access_person, :term=>[:access, :machine, :person]
35
35
  }
36
- t.discover_access(:ref=>[:access], :attributes=>{:type=>"discover"})
37
- t.read_access(:ref=>[:access], :attributes=>{:type=>"read"})
38
- t.edit_access(:ref=>[:access], :attributes=>{:type=>"edit"})
36
+ t.discover_access(:ref => [:access], :attributes => {:type => 'discover'})
37
+ t.read_access(:ref => [:access], :attributes => {:type => 'read'})
38
+ t.edit_access(:ref => [:access], :attributes => {:type => 'edit'})
39
39
  # A bug in OM prevnts us from declaring proxy terms at the root of a Terminology
40
40
  # t.access_person(:proxy=>[:access,:machine,:person])
41
41
  # t.access_group(:proxy=>[:access,:machine,:group])
42
-
42
+
43
43
  t.embargo {
44
- t.human_readable(:path=>"human")
44
+ t.human_readable(:path => 'human')
45
45
  t.machine{
46
- t.date(:type =>"release")
46
+ t.date(:type => 'release')
47
47
  }
48
48
  t.embargo_release_date(:proxy => [:machine, :date])
49
- }
49
+ }
50
50
  end
51
-
51
+
52
52
  # Generates an empty Mods Article (used when you call ModsArticle.new without passing in existing xml)
53
53
  def self.xml_template
54
54
  builder = Nokogiri::XML::Builder.new do |xml|
55
- xml.rightsMetadata(:version=>"0.1", "xmlns"=>"http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1") {
55
+ xml.rightsMetadata(:version => '0.1', 'xmlns' => 'http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1') {
56
56
  xml.copyright {
57
57
  xml.human
58
58
  xml.machine {
59
- xml.uvalicense "no"
59
+ xml.uvalicense 'no'
60
60
  }
61
61
  }
62
- xml.access(:type=>"discover") {
62
+ xml.access(:type => 'discover') {
63
63
  xml.human
64
64
  xml.machine
65
65
  }
66
- xml.access(:type=>"read") {
67
- xml.human
66
+ xml.access(:type => 'read') {
67
+ xml.human
68
68
  xml.machine
69
69
  }
70
- xml.access(:type=>"edit") {
70
+ xml.access(:type => 'edit') {
71
71
  xml.human
72
72
  xml.machine
73
73
  }
74
74
  xml.embargo{
75
75
  xml.human
76
76
  xml.machine
77
- }
77
+ }
78
78
  }
79
79
  end
80
80
  return builder.doc
81
81
  end
82
-
82
+
83
83
  # Returns the permissions for the selected person/group
84
- # If new_access_level is provided, updates the selected person/group access_level to the one specified
84
+ # If new_access_level is provided, updates the selected person/group access_level to the one specified
85
85
  # A new_access_level of "none" will remove all access_levels for the selected person/group
86
86
  # @param [Hash] selector
87
87
  # @param [String] new_access_level (default nil)
88
- # @return [Hash]
89
- #
88
+ # @return [Hash]
89
+ #
90
90
  # @example Query permissions for person123, Set the permissions to "read", then query again to see that they have changed.
91
91
  # permissions({:person=>"person123"})
92
92
  # => {"person123"=>"edit"}
@@ -94,32 +94,32 @@ module Hydra
94
94
  # => {"person123"=>"read"}
95
95
  # permissions({:person=>"person123"})
96
96
  # => {"person123"=>"read"}
97
- def permissions(selector, new_access_level=nil)
98
-
97
+ def permissions(selector, new_access_level = nil)
98
+
99
99
  type = selector.keys.first.to_sym
100
100
  actor = selector.values.first
101
101
  if new_access_level.nil?
102
102
  xpath = self.class.terminology.xpath_for(:access, type, actor)
103
103
  nodeset = self.find_by_terms(xpath)
104
104
  if nodeset.empty?
105
- return "none"
105
+ return 'none'
106
106
  else
107
- return nodeset.first.ancestors("access").first.attributes["type"].text
107
+ return nodeset.first.ancestors('access').first.attributes['type'].text
108
108
  end
109
109
  else
110
110
  remove_all_permissions(selector)
111
- unless new_access_level == "none"
111
+ unless new_access_level == 'none'
112
112
  access_type_symbol = "#{new_access_level}_access".to_sym
113
- result = self.update_values([access_type_symbol, type] => {"-1"=>actor})
113
+ result = self.update_values([access_type_symbol, type] => {'-1' => actor})
114
114
  end
115
115
  self.dirty = true
116
116
  return new_access_level
117
117
  end
118
-
118
+
119
119
  end
120
-
120
+
121
121
  # Reports on which groups have which permissions
122
- # @return [Hash]
122
+ # @return [Hash]
123
123
  # @example
124
124
  # sample_ds.permissions({"group"=>"group_zzz"}, "edit")
125
125
  # sample_ds.permissions({"group"=>"public"}, "discover")
@@ -127,9 +127,9 @@ module Hydra
127
127
  def groups
128
128
  return quick_search_by_type(:group)
129
129
  end
130
-
130
+
131
131
  # Reports on which groups have which permissions
132
- # @return [Hash]
132
+ # @return [Hash]
133
133
  # @example
134
134
  # sample_ds.permissions({"person"=>"person_123"}, "read")
135
135
  # sample_ds.permissions({""person"=>"person_456"}, "edit")
@@ -137,21 +137,21 @@ module Hydra
137
137
  def individuals
138
138
  return quick_search_by_type(:person)
139
139
  end
140
-
140
+
141
141
  # Updates permissions for all of the persons and groups in a hash
142
142
  # @param [Hash] params example: {"group"=>{"group1"=>"discover","group2"=>"edit"}, "person"=>{"person1"=>"read","person2"=>"discover"}}
143
143
  # Currently restricts actor type to group or person. Any others will be ignored
144
144
  def update_permissions(params)
145
- params.fetch("group", {}).each_pair {|group_id, access_level| self.permissions({"group"=>group_id}, access_level)}
146
- params.fetch("person", {}).each_pair {|group_id, access_level| self.permissions({"person"=>group_id}, access_level)}
145
+ params.fetch('group', {}).each_pair {|group_id, access_level| self.permissions({'group' => group_id}, access_level)}
146
+ params.fetch('person', {}).each_pair {|group_id, access_level| self.permissions({'person' => group_id}, access_level)}
147
147
  end
148
-
148
+
149
149
  # This method limits the response to known access levels (:discover, :read, :edit). Probably runs a bit faster than {#permissions}.
150
- # @param [:group,:person] type
151
- # @return [Hash]
150
+ # @param [:group,:person] type
151
+ # @return [Hash]
152
152
  def quick_search_by_type(type)
153
153
  result = {}
154
- [{:discover_access=>"discover"},{:read_access=>"read"},{:edit_access=>"edit"}].each do |access_levels_hash|
154
+ [{:discover_access => 'discover'}, {:read_access => 'read'}, {:edit_access => 'edit'}].each do |access_levels_hash|
155
155
  access_level = access_levels_hash.keys.first
156
156
  access_level_name = access_levels_hash.values.first
157
157
  self.find_by_terms(*[access_level, type]).each do |entry|
@@ -166,15 +166,15 @@ module Hydra
166
166
  release_date = release_date.to_s if release_date.is_a? Date
167
167
  begin
168
168
  Date.parse(release_date)
169
- rescue
170
- return "INVALID DATE"
169
+ rescue
170
+ return 'INVALID DATE'
171
171
  end
172
- self.update_values({[:embargo,:machine,:date]=>release_date})
172
+ self.update_values({[:embargo, :machine, :date] => release_date})
173
173
  end
174
- def embargo_release_date(opts={})
175
- embargo_release_date = self.find_by_terms(*[:embargo,:machine,:date]).first ? self.find_by_terms(*[:embargo,:machine,:date]).first.text : nil
174
+ def embargo_release_date(opts = {})
175
+ embargo_release_date = self.find_by_terms(*[:embargo, :machine, :date]).first ? self.find_by_terms(*[:embargo, :machine, :date]).first.text : nil
176
176
  if opts[:format] && opts[:format] == :solr_date
177
- embargo_release_date << "T23:59:59Z"
177
+ embargo_release_date << 'T23:59:59Z'
178
178
  end
179
179
  embargo_release_date
180
180
  end
@@ -182,18 +182,18 @@ module Hydra
182
182
  (embargo_release_date && Date.today < embargo_release_date.to_date) ? true : false
183
183
  end
184
184
 
185
- def to_solr(solr_doc=Hash.new)
185
+ def to_solr(solr_doc = {})
186
186
  super(solr_doc)
187
- ::Solrizer::Extractor.insert_solr_field_value(solr_doc, "embargo_release_date_dt", embargo_release_date(:format=>:solr_date)) if embargo_release_date
187
+ ::Solrizer::Extractor.insert_solr_field_value(solr_doc, 'embargo_release_date_dt', embargo_release_date(:format => :solr_date)) if embargo_release_date
188
188
  solr_doc
189
189
  end
190
190
 
191
191
 
192
192
 
193
193
 
194
-
194
+
195
195
  private
196
- # Purge all access given group/person
196
+ # Purge all access given group/person
197
197
  def remove_all_permissions(selector)
198
198
  type = selector.keys.first.to_sym
199
199
  actor = selector.values.first
@@ -201,6 +201,6 @@ module Hydra
201
201
  nodes_to_purge = self.find_by_terms(xpath)
202
202
  nodes_to_purge.each {|node| node.remove}
203
203
  end
204
-
204
+
205
205
  end
206
206
  end
@@ -1,4 +1,4 @@
1
- require "active-fedora"
1
+ require 'active-fedora'
2
2
  module Marpa
3
3
 
4
4
  # This is an example of a OmDatastream that defines a terminology for Dublin Core xml
@@ -11,18 +11,18 @@ module Marpa
11
11
  # * Does not override or extend to_solr, so the default solrization approach will be used (Solrizer::XML::TerminologyBasedSolrizer)
12
12
  #
13
13
  class DcDatastream < ActiveFedora::OmDatastream
14
-
14
+
15
15
  set_terminology do |t|
16
- t.root(:path=>"dc", :xmlns=>'http://purl.org/dc/terms/')
17
- t.tibetan_title(:path=>"title", :attributes=>{:language=>"tibetan"})
18
- t.english_title(:path=>"title", :attributes=>{:language=>:none})
19
- t.contributor(:index_as=>[:facetable])
16
+ t.root(:path => 'dc', :xmlns => 'http://purl.org/dc/terms/')
17
+ t.tibetan_title(:path => 'title', :attributes => {:language => 'tibetan'})
18
+ t.english_title(:path => 'title', :attributes => {:language => :none})
19
+ t.contributor(:index_as => [:facetable])
20
20
  t.coverage
21
21
  t.creator
22
22
  t.description
23
23
  t.format
24
24
  t.identifier
25
- t.language(:index_as=>[:facetable])
25
+ t.language(:index_as => [:facetable])
26
26
  t.publisher
27
27
  t.relation
28
28
  t.source
@@ -41,7 +41,7 @@ module Marpa
41
41
  t.coverage
42
42
  t.created
43
43
  t.creator
44
- t.date(:index_as=>[:facetable])
44
+ t.date(:index_as => [:facetable])
45
45
  t.dateAccepted
46
46
  t.dateCopyrighted
47
47
  t.dateSubmitted
@@ -61,7 +61,7 @@ module Marpa
61
61
  t.isRequiredBy
62
62
  t.issued
63
63
  t.isVersionOf
64
- t.language(:index_as=>[:facetable])
64
+ t.language(:index_as => [:facetable])
65
65
  t.license
66
66
  t.mediator
67
67
  t.medium
@@ -75,23 +75,23 @@ module Marpa
75
75
  t.rights
76
76
  t.rightsHolder
77
77
  t.source
78
- t.spatial(:index_as=>[:facetable])
79
- t.subject(:index_as=>[:facetable])
78
+ t.spatial(:index_as => [:facetable])
79
+ t.subject(:index_as => [:facetable])
80
80
  t.tableOfContents
81
81
  t.temporal
82
82
  t.type
83
83
  t.valid
84
84
  end
85
-
85
+
86
86
  def self.xml_template
87
87
  builder = Nokogiri::XML::Builder.new do |xml|
88
- xml.dc("xmlns"=>'http://purl.org/dc/terms/',
89
- "xmlns:dcterms"=>'http://purl.org/dc/terms/',
90
- "xmlns:xsi"=>'http://www.w3.org/2001/XMLSchema-instance') {
88
+ xml.dc('xmlns' => 'http://purl.org/dc/terms/',
89
+ 'xmlns:dcterms' => 'http://purl.org/dc/terms/',
90
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance') {
91
91
  }
92
92
  end
93
93
  return builder.doc
94
94
  end
95
-
95
+
96
96
  end
97
- end
97
+ end
@@ -1,29 +1,29 @@
1
1
  require 'active-fedora'
2
2
 
3
3
  class AudioRecord
4
-
4
+
5
5
  include ActiveFedora::Model
6
-
7
- # This seems a bit strange, since this Class might be used outside of Oral Histories.
6
+
7
+ # This seems a bit strange, since this Class might be used outside of Oral Histories.
8
8
  # From this perspective, it makes more sense to put triples on the containing object, not on the children...
9
-
10
- relationship "parents", :is_part_of, [nil, :oral_history]
9
+
10
+ relationship 'parents', :is_part_of, [nil, :oral_history]
11
11
  #has n, :parents, {:predicate => :is_part_of, :likely_types => [nil, :oral_history]}
12
12
  # OR
13
13
  # is_part_of [:oral_history]
14
-
15
- property "date_recorded", :date
16
- property "file_name", :string
17
- property "duration", :string
18
- property "notes", :text
14
+
15
+ property 'date_recorded', :date
16
+ property 'file_name', :string
17
+ property 'duration', :string
18
+ property 'notes', :text
19
19
 
20
20
  # This doesn't make sense when you have both compressed and uncompressed in the same object!
21
- # Probably better to rely on the file size in datastreamVersion "SIZE" attribute from Fedora anyway
21
+ # Probably better to rely on the file size in datastreamVersion "SIZE" attribute from Fedora anyway
22
22
  #property "file_size", :integer
23
23
 
24
24
  #property "restriction", :text
25
-
26
- datastream "compressed", ["audio/mpeg"], :multiple => true
27
- datastream "uncompressed", ["audio/wav", "audio/aiff"], :multiple => true
28
-
29
- end
25
+
26
+ datastream 'compressed', ['audio/mpeg'], :multiple => true
27
+ datastream 'uncompressed', ['audio/wav', 'audio/aiff'], :multiple => true
28
+
29
+ end
@@ -1,5 +1,5 @@
1
1
  require 'active-fedora'
2
2
 
3
- class Image
3
+ class Image
4
4
  include ActiveFedora::Model
5
- end
5
+ end
@@ -1,4 +1,4 @@
1
- require "active-fedora"
1
+ require 'active-fedora'
2
2
  require_relative '../hydra-mods_article_datastream.rb'
3
3
  require_relative '../hydra-rights_metadata_datastream.rb'
4
4
 
@@ -6,9 +6,9 @@ require_relative '../hydra-rights_metadata_datastream.rb'
6
6
  #
7
7
  # See lib/samples/sample_thing.rb for a fuller, annotated example of an ActiveFedora Model
8
8
  class ModsArticle < ActiveFedora::Base
9
-
10
- has_metadata :name => "descMetadata", :type=> Hydra::ModsArticleDatastream
11
- has_metadata :name => "rightsMetadata", :type => Hydra::RightsMetadataDatastream
12
- has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream
9
+
10
+ has_metadata :name => 'descMetadata', :type => Hydra::ModsArticleDatastream
11
+ has_metadata :name => 'rightsMetadata', :type => Hydra::RightsMetadataDatastream
12
+ has_metadata :name => 'properties', :type => ActiveFedora::SimpleDatastream
13
13
 
14
14
  end
@@ -2,25 +2,25 @@ require 'active-fedora'
2
2
 
3
3
  class OralHistory < ActiveFedora::Base
4
4
  # Imitating DataMapper ...
5
-
6
- has_many :parts, :property=>:is_part_of
7
-
5
+
6
+ has_many :parts, :property => :is_part_of
7
+
8
8
  # These are all the properties that don't quite fit into Qualified DC
9
9
  # Put them on the object itself (in the properties datastream) for now.
10
- has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
11
- field "alt_title", :string
12
- field "narrator", :string
13
- field "interviewer", :integer
14
- field "transcript_editor", :text
15
- field "bio", :string
16
- field "notes", :text
17
- field "hard_copy_availability", :text
18
- field "hard_copy_location", :text
19
- field "other_contributors", :string
20
- field "restrictions", :text
10
+ has_metadata :name => 'properties', :type => ActiveFedora::SimpleDatastream do |m|
11
+ field 'alt_title', :string
12
+ field 'narrator', :string
13
+ field 'interviewer', :integer
14
+ field 'transcript_editor', :text
15
+ field 'bio', :string
16
+ field 'notes', :text
17
+ field 'hard_copy_availability', :text
18
+ field 'hard_copy_location', :text
19
+ field 'other_contributors', :string
20
+ field 'restrictions', :text
21
21
  end
22
-
23
- has_metadata :name => "dublin_core", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
22
+
23
+ has_metadata :name => 'dublin_core', :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
24
24
  # Default :multiple => true
25
25
  #
26
26
  # on retrieval, these will be pluralized and returned as arrays
@@ -28,9 +28,9 @@ class OralHistory < ActiveFedora::Base
28
28
  #
29
29
  # aimint to use method-missing to support calling methods like
30
30
  # my_oral_history.subjects OR my_oral_history.titles OR EVEN my_oral_history.title whenever possible
31
-
31
+
32
32
  #field :name => "subject_heading", :string, {:xml_node => "subject", :encoding => "LCSH"}
33
33
  end
34
34
 
35
-
35
+
36
36
  end