module DigitalOpera::Document::ClassMethods
Public Instance Methods
field(name, options = {})
click to toggle source
Defines all the fields that are accessible on the Document
For each field that is defined, a getter and setter will be added as an instance method to the Document
.
@example Define a field.
field :score, :type => Integer, :default => 0
@param [ Symbol ] name The name of the field. @param [ Hash ] options The options to pass to the field.
@return [ Field ] The generated field
# File lib/digital_opera/document.rb, line 31 def field(name, options = {}) named = name.to_s added = add_field(named, options) descendants.each do |subclass| subclass.add_field(named, options) end added end