Class: Wikidatum::Reference

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hashString (readonly)

Returns Hash of the reference (a cryptographic hash, not a Ruby hash).

Returns:

  • (String)

    Hash of the reference (a cryptographic hash, not a Ruby hash).



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

def hash
  @hash
end

#partsArray<Wikidatum::ReferencePart> (readonly)

Returns:



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

def parts
  @parts
end

Instance Method Details

#inspectString

Returns:

  • (String)


27
28
29
# File 'lib/wikidatum/reference.rb', line 27

def inspect
  "<Wikidatum::Reference hash=#{@hash.inspect} parts=#{@parts.inspect}>"
end

#to_hHash

Returns:

  • (Hash)


19
20
21
22
23
24
# File 'lib/wikidatum/reference.rb', line 19

def to_h
  {
    hash: @hash,
    parts: @parts.map(&:to_h)
  }
end