Sha256: 157ef64e3bd6c95f27bd90aa59446143087bb30d30a75b7a0d831545b522ccac

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

require "mida"

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

require "uri"

module URI
  def to_json
    to_s.to_json
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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