Module: ActiveFedora::AttachedFiles::ClassMethods
- Extended by:
- Deprecation
- Defined in:
- lib/active_fedora/attached_files.rb
Instance Method Summary collapse
- #ds_specs ⇒ Object
- #has_file_datastream(*args) ⇒ Object
-
#has_metadata(*args) { ... } ⇒ Object
This method is used to specify the details of a datastream.
Instance Method Details
#ds_specs ⇒ Object
155 156 157 |
# File 'lib/active_fedora/attached_files.rb', line 155 def ds_specs child_resource_reflections end |
#has_file_datastream(name, args) ⇒ Object #has_file_datastream(args) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/active_fedora/attached_files.rb', line 200 def has_file_datastream(*args) if args.first.is_a? String name = args.first args = args[1] || {} args[:name] = name else args = args.first || {} end name = args.delete(:name) args[:class_name] = args.delete(:type).to_s contains(name, args) end |
#has_metadata(*args) { ... } ⇒ Object
This method is used to specify the details of a datastream. You can pass the name as the first argument and a hash of options as the second argument or you can pass the :name as a value in the args hash. Either way, name is required. Note that this method doesn’t actually execute the block, but stores it, to be executed by any the implementation of the datastream(specified as :type)
172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/active_fedora/attached_files.rb', line 172 def (*args, &block) if args.first.is_a? String name = args.first args = args[1] || {} args[:name] = name else args = args.first || {} end name = args.delete(:name) raise ArgumentError, "You must provide a :type property for the datastream '#{name}'" unless args[:type] args[:class_name] = args.delete(:type).to_s contains(name, args, &block) end |