Class: Wikidatum::DataValueType::WikibaseString

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

Overview

The String type datavalue JSON looks like this:

“‘json {

"datavalue": {
  "value": "Foobar",
  "type": "string"
}

} “‘

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string:) ⇒ void

Parameters:

  • string (String)


21
22
23
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 21

def initialize(string:)
  @string = string
end

Instance Attribute Details

#stringString (readonly)

Returns the value for the string.

Returns:

  • (String)

    the value for the string.



17
18
19
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 17

def string
  @string
end

Instance Method Details

#to_hHash

Returns:

  • (Hash)


26
27
28
29
30
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 26

def to_h
  {
    string: @string
  }
end

#wikibase_datatypeString

The “datatype” value used by Wikibase, usually identical to wikibase_type but not always.

Returns:

  • (String)


43
44
45
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 43

def wikibase_datatype
  wikibase_type
end

#wikibase_typeString

The “type” value used by Wikibase, for use when creating/updating statements.

Returns:

  • (String)


35
36
37
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 35

def wikibase_type
  'string'
end