Sha256: a30275faaec0eeee5b57447b18530d52d483b5d2f03ce5629c853a7606c4b12f

Contents?: true

Size: 564 Bytes

Versions: 1

Compression:

Stored size: 564 Bytes

Contents

require "mida_vocabulary"

class Mida::Vocabulary::Custom < Mida::Vocabulary
  attr_reader :itemtype
  def initialize(itemtype)
    @itemtype = %r{#{itemtype}}
  end
end

def Mida(itemtype, addition = nil)
  if itemtype.is_a?(Symbol)
    itemtype = "http://schema.org/#{itemtype}"
  end

  found_voc = Mida::Vocabulary.find(itemtype)
  
  if found_voc == Mida::GenericVocabulary
    found_voc = Mida::Vocabulary::Custom.new(itemtype)
  end
  
  if addition
    Mida::Vocabulary::Custom.new(found_voc.itemtype.source + "/#{addition}")
  else
    found_voc
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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