module Merritt::Manifest::Field
Mixin for field enumerations
Public Class Methods
included(base)
click to toggle source
Implemented to inject {ClassMethods} into field enumerations that include this module
# File lib/merritt/manifest/fields.rb, line 35 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
field_name()
click to toggle source
@return [String] the fieldname
# File lib/merritt/manifest/fields.rb, line 22 def field_name value end
prefix()
click to toggle source
The prefix for this field
# File lib/merritt/manifest/fields.rb, line 27 def prefix @prefix ||= begin prefix, name = value.split(':') prefix if name # if we didn't find a name, then there's no ':' and hence no prefix end end
reader()
click to toggle source
Gets the reader method for this field
# File lib/merritt/manifest/fields.rb, line 11 def reader @reader ||= key.downcase end
value_from(obj)
click to toggle source
Reads the value of this field from the specified object, if available
# File lib/merritt/manifest/fields.rb, line 16 def value_from(obj) return unless obj.respond_to?(reader) obj.send(reader) end