Module: GreenMonkey::ModelHelpers::ClassMethods

Defined in:
lib/green_monkey/ext/active_model.rb

Instance Method Summary collapse

Instance Method Details

#html_schema_type(value = nil, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/green_monkey/ext/active_model.rb', line 12

def html_schema_type(value = nil, options = {})
  return @html_schema_type unless value

  value = /#{value}/ if value.is_a?(Symbol)
  if value.is_a?(Regexp)
    value = Mida::Vocabulary.vocabularies.find do |vocabulary|
      vocabulary.itemtype.to_s =~ value && vocabulary.itemtype.to_s
    end
  end

  @html_schema_type = value
  @html_schema_options = options
end