Sha256: 786fd1e63d3e1d63a4b12d2dc20ed81553908c3f1f9533439a8e917ccb844e92

Contents?: true

Size: 661 Bytes

Versions: 3

Compression:

Stored size: 661 Bytes

Contents

module Wikidata
  module Property
    def self.build attribute
      return if %w{somevalue novalue}.include? attribute.mainsnak.snaktype
      case attribute.mainsnak.datatype
      when 'string'
        Wikidata::Property::String.new attribute
      when 'time'
        Wikidata::Property::Time.new attribute
      when 'globe-coordinate'
        Wikidata::Property::GlobeCoordinate.new attribute
      when 'url'
        Wikidata::Property::Url.new attribute
      when 'wikibase-item'
        Wikidata::Item.find Wikidata::Entity.entity_id(attribute)
      else
        puts "Unkown property type #{attribute.mainsnak.datatype}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wikidata-client-0.0.6 lib/wikidata/property.rb
wikidata-client-0.0.5 lib/wikidata/property.rb
wikidata-client-0.0.4 lib/wikidata/property.rb