Module: AVM::ControlledVocabulary

Included in:
CoordinateFrame, CoordinateSystemProjection, ImageQuality, ImageType, SpatialQuality
Defined in:
lib/avm/controlled_vocabulary.rb

Overview

Build a ControlledVocabulary set of classes for use with CV fields

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/avm/controlled_vocabulary.rb', line 5

def included(klass)
  klass::TERMS.each do |type|
    new_klass = Class.new do
      def to_s
        self.class.to_s.split('::').last
      end

      def ==(other)
        self.to_s == other.to_s
      end
    end

    klass.const_set(type.to_sym, new_klass)
  end
end