Class: Wikidatum::DataValueType::WikibaseString
- Inherits:
-
Object
- Object
- Wikidatum::DataValueType::WikibaseString
- 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
-
#string ⇒ String
readonly
The value for the string.
Instance Method Summary collapse
- #initialize(string:) ⇒ void constructor
- #to_h ⇒ Hash
-
#wikibase_datatype ⇒ String
The “datatype” value used by Wikibase, usually identical to wikibase_type but not always.
-
#wikibase_type ⇒ String
The “type” value used by Wikibase, for use when creating/updating statements.
Constructor Details
#initialize(string:) ⇒ void
21 22 23 |
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 21 def initialize(string:) @string = string end |
Instance Attribute Details
#string ⇒ String (readonly)
Returns 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_h ⇒ Hash
26 27 28 29 30 |
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 26 def to_h { string: @string } end |
#wikibase_datatype ⇒ String
The “datatype” value used by Wikibase, usually identical to wikibase_type but not always.
43 44 45 |
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 43 def wikibase_datatype wikibase_type end |
#wikibase_type ⇒ String
The “type” value used by Wikibase, for use when creating/updating statements.
35 36 37 |
# File 'lib/wikidatum/data_value_type/wikibase_string.rb', line 35 def wikibase_type 'string' end |