Class: OpenURL::Inventor

Inherits:
Object
  • Object
show all
Defined in:
lib/openurl/metadata_formats/scholarly_common.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInventor

Returns a new instance of Inventor.



179
180
# File 'lib/openurl/metadata_formats/scholarly_common.rb', line 179

def initialize      
end

Instance Attribute Details

#invObject

Returns the value of attribute inv.



178
179
180
# File 'lib/openurl/metadata_formats/scholarly_common.rb', line 178

def inv
  @inv
end

#invfirstObject

Returns the value of attribute invfirst.



178
179
180
# File 'lib/openurl/metadata_formats/scholarly_common.rb', line 178

def invfirst
  @invfirst
end

#invlastObject

Returns the value of attribute invlast.



178
179
180
# File 'lib/openurl/metadata_formats/scholarly_common.rb', line 178

def invlast
  @invlast
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


200
201
202
203
204
205
# File 'lib/openurl/metadata_formats/scholarly_common.rb', line 200

def empty?
  self.instance_variables.each do | ivar |
    return false if self.instance_variable_get(ivar)
  end
  return true
end

#xml(elem) ⇒ Object



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/openurl/metadata_formats/scholarly_common.rb', line 182

def xml(elem)      
  if @inv        
    inv = elem.add_element("#{elem.prefix}:inv") 
    inv.text = @inv
  end
  if @invlast || @invfirst
    inventor = elem.add_element("#{elem.prefix}:inventor")
    if @invlast
      invlast = inventor.add_element("#{elem.prefix}:invlast")
      invlast.text = @invlast
    end
    if @invfirst
      invfirst = inventor.add_element("#{elem.prefix}:invfirst")
      invfirst.text = @invfirst
    end             
  end
end