Class: Wikidatum::ReferencePart

Inherits:
Object
  • Object
show all
Defined in:
lib/wikidatum/reference_part.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#data_typeString (readonly)

Returns:

  • (String)


8
9
10
# File 'lib/wikidatum/reference_part.rb', line 8

def data_type
  @data_type
end

#property_idString (readonly)

Returns ID of the property used, in the format “P123”.

Returns:

  • (String)

    ID of the property used, in the format “P123”.



5
6
7
# File 'lib/wikidatum/reference_part.rb', line 5

def property_id
  @property_id
end

#valueWikidatum::DataType::Base (readonly)

For more information on the possible types that can be returned by datavalues, see the official documentation: doc.wikimedia.org/Wikibase/master/php/docs_topics_json.html#json_datavalues

Returns:



15
16
17
# File 'lib/wikidatum/reference_part.rb', line 15

def value
  @value
end

Instance Method Details

#inspectString

Returns:

  • (String)


37
38
39
# File 'lib/wikidatum/reference_part.rb', line 37

def inspect
  "<Wikidatum::ReferencePart property_id=#{@property_id.inspect} data_type=#{@data_type.inspect} value=#{@value.inspect}>"
end

#to_hHash

Returns:

  • (Hash)


28
29
30
31
32
33
34
# File 'lib/wikidatum/reference_part.rb', line 28

def to_h
  {
    property_id: @property_id,
    data_type: @data_type,
    value: @value.to_h
  }
end