Class: Wikidatum::Term

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

Overview

Wikidatum::Term represents “Terms”, which are pairs of language codes and values. They’re used for things like item labels, descriptions, and aliases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#langString (readonly)

Returns A language code (‘en’, ‘zh-mo’, etc).

Returns:

  • (String)

    A language code (‘en’, ‘zh-mo’, etc).



7
8
9
# File 'lib/wikidatum/term.rb', line 7

def lang
  @lang
end

#valueString (readonly)

Returns The value of the Term.

Returns:

  • (String)

    The value of the Term.



10
11
12
# File 'lib/wikidatum/term.rb', line 10

def value
  @value
end

Instance Method Details

#inspectString

Returns:

  • (String)


31
32
33
# File 'lib/wikidatum/term.rb', line 31

def inspect
  "<Wikidatum::Term lang=#{@lang.inspect} value=#{@value.inspect}>"
end

#to_hHash

Returns:

  • (Hash)


23
24
25
26
27
28
# File 'lib/wikidatum/term.rb', line 23

def to_h
  {
    lang: @lang,
    value: @value
  }
end