Sha256: d35aecbb194cab2dcdef9b4b8a1b885e4a17a8c852d39d962ca857722bf8a155

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

# coding: utf-8

module GreenMonkey
  module ModelHelpers
    extend ActiveSupport::Concern

    def html_schema_type
      self.class.html_schema_type
    end

    module ClassMethods
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
green_monkey-0.1.4 lib/green_monkey/ext/active_model.rb