Class: Wikidatum::DataType::WikibaseString
- Inherits:
-
Object
- Object
- Wikidatum::DataType::WikibaseString
- Defined in:
- lib/wikidatum/data_type/wikibase_string.rb
Overview
The String type JSON looks like this:
{
"property": {
"id": "P143",
"data-type": "string"
},
"value": {
"type": "value",
"content": "foo"
}
}
Direct Known Subclasses
Instance Attribute Summary collapse
-
#string ⇒ String
readonly
The value for the string.
Class Method Summary collapse
Instance Method Summary collapse
-
#humanized ⇒ String
The content of the data value object.
- #initialize(string:) ⇒ void constructor
- #to_h ⇒ Hash
-
#wikibase_type ⇒ String
The “type” value used by Wikibase, for use when creating/updating statements.
Constructor Details
#initialize(string:) ⇒ void
25 26 27 |
# File 'lib/wikidatum/data_type/wikibase_string.rb', line 25 def initialize(string:) @string = string end |
Instance Attribute Details
#string ⇒ String (readonly)
Returns the value for the string.
21 22 23 |
# File 'lib/wikidatum/data_type/wikibase_string.rb', line 21 def string @string end |
Class Method Details
.symbolized_name ⇒ Symbol
52 53 54 |
# File 'lib/wikidatum/data_type/wikibase_string.rb', line 52 def self.symbolized_name :string end |
Instance Method Details
#humanized ⇒ String
The content of the data value object. Use this to get a more sensible representation of the statement’s contents.
47 48 49 |
# File 'lib/wikidatum/data_type/wikibase_string.rb', line 47 def humanized @string end |
#to_h ⇒ Hash
30 31 32 33 34 |
# File 'lib/wikidatum/data_type/wikibase_string.rb', line 30 def to_h { string: @string } end |
#wikibase_type ⇒ String
The “type” value used by Wikibase, for use when creating/updating statements.
39 40 41 |
# File 'lib/wikidatum/data_type/wikibase_string.rb', line 39 def wikibase_type 'string' end |