Sha256: e151495945ac161df4a473ccb23238ec8b7f4123322d6258ff9b68e936c61eac

Contents?: true

Size: 584 Bytes

Versions: 3

Compression:

Stored size: 584 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)
        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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
green_monkey-0.1.3 lib/green_monkey/ext/active_model.rb
green_monkey-0.1.2 lib/green_monkey/ext/active_model.rb
green_monkey-0.1.1 lib/green_monkey/ext/active_model.rb