Class: OpenURL::ScholarlyServiceType

Inherits:
ContextObjectEntity show all
Defined in:
lib/openurl/metadata_formats/scholarly_service_type.rb

Instance Attribute Summary

Attributes inherited from ContextObjectEntity

#abbr, #format, #identifiers, #label, #metadata, #private_data, #reference

Instance Method Summary collapse

Methods inherited from ContextObjectEntity

#add_identifier, #delete_identifier, #empty?, #get_metadata, #identifier, #import_xml_metadata, #kev, new_from_format, normalize_id, #serialize_metadata, #set_format, #set_metadata, #set_private_data, #set_reference, #to_hash, #xml, #xml_for_ref_entity

Constructor Details

#initializeScholarlyServiceType

Returns a new instance of ScholarlyServiceType.



13
14
15
16
17
18
19
# File 'lib/openurl/metadata_formats/scholarly_service_type.rb', line 13

def initialize      
  super
  @format = 'sch_svc'      
  @metadata_keys = ['abstract','citation','fulltext','holdings','ill','any']      
  @xml_ns = "info:ofi/fmt:xml:xsd:sch_svc"
  @kev_ns = "info:ofi/fmt:kev:mtx:sch_svc"
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(metadata, value = nil) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
# File 'lib/openurl/metadata_formats/scholarly_service_type.rb', line 21

def method_missing(, value=nil)
  meta = .to_s.sub(/=$/,'')
  raise ArgumentError, "#{meta.to_s} is not a valid #{self.class} metadata field." unless @metadata_keys.index(meta)
  if .to_s.match(/=$/)
    self.(meta, value)
  else
    return self.[meta]
  end
  
end