class AMEE::DataAbstraction::Metadatum

Subclass of Input providing methods and attributes appropriate for representing arbitrary metadata which does not correspond to any AMEE profile item value or drill.

Public Class Methods

new(options={},&block) click to toggle source

Initialization of Metadatum objects follows that of the parent Input class. The interface attribute of self is set to :drop_down by default, but can be manually configured if required.

Calls superclass method AMEE::DataAbstraction::Input::new
# File lib/amee-data-abstraction/metadatum.rb, line 20
def initialize(options={},&block)
  super
  interface :drop_down unless interface
end

Public Instance Methods

compulsory?(usage=nil) click to toggle source

Returns false as all metadatum are arbitrarily defined and therefore not directly involved in any AMEE calculation.

# File lib/amee-data-abstraction/metadatum.rb, line 42
def compulsory?(usage=nil)
  false
end
valid?() click to toggle source

Returns true if the value set for self is valid. If self contains neither a custom validation pattern nor any defined choices, true is returned. Otherwise, validity depends on the custom validation being successful (if present) and the the value of self matching one of the entries in the choices attribute (if defined). Otherwise, returns false.

Calls superclass method AMEE::DataAbstraction::Input#valid?
# File lib/amee-data-abstraction/metadatum.rb, line 53
def valid?
  super && (choices.blank? || choices.include?(value))
end