class Mida::PropertyDesc

Class used to describe a property

Public Class Methods

new(num, &block) click to toggle source
# File lib/mida_vocabulary/propertydesc.rb, line 5
def initialize(num, &block)
  @num, @types = num, []
  if block_given?
    instance_eval(&block)
    @types = [DataType::Text] unless @types.size >= 1
  else
    @types = [DataType::Text]
  end
end

Public Instance Methods

extract(*types) click to toggle source

What to extract for this property. This can be a datatype such as :text or a Vocabulary. The types should be supplied in order of preference. If you want to say any type, then use :any as the class

# File lib/mida_vocabulary/propertydesc.rb, line 19
def extract(*types)
  @types += types
end
to_h() click to toggle source
# File lib/mida_vocabulary/propertydesc.rb, line 30
def to_h
  {num: @num, types: @types}
end
types(*types) click to toggle source

DEPRECATED: Please use extract instead

# File lib/mida_vocabulary/propertydesc.rb, line 24
def types(*types)
  warn "[DEPRECATION] Mida::PropertyDesc#types is deprecated.  "+
       "Please use Mida::PropertyDesc#extract instead."
  extract *types
end