Class: WikibaseRepresentable::Model::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/wikibase_representable/model/property.rb

Overview

Represents a single Wikibase property.

Constant Summary collapse

ENTITY_TYPE =
'property'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Property

Returns a new instance of Property.



16
17
18
19
20
21
22
23
24
# File 'lib/wikibase_representable/model/property.rb', line 16

def initialize(**kwargs)
  @type = ENTITY_TYPE
  @data_type = kwargs[:data_type]
  @id = kwargs[:id]
  @labels_hash = kwargs[:labels_hash] || TermHash.new
  @descriptions_hash = kwargs[:descriptions_hash] || TermHash.new
  @alias_groups_hash = kwargs[:alias_groups_hash] || AliasGroupHash.new
  @statements_hash = kwargs[:statements_hash] || StatementHash.new
end

Instance Attribute Details

#alias_groups_hashObject

Returns the value of attribute alias_groups_hash.



14
15
16
# File 'lib/wikibase_representable/model/property.rb', line 14

def alias_groups_hash
  @alias_groups_hash
end

#data_typeObject

Returns the value of attribute data_type.



14
15
16
# File 'lib/wikibase_representable/model/property.rb', line 14

def data_type
  @data_type
end

#descriptions_hashObject

Returns the value of attribute descriptions_hash.



14
15
16
# File 'lib/wikibase_representable/model/property.rb', line 14

def descriptions_hash
  @descriptions_hash
end

#idObject

Returns the value of attribute id.



14
15
16
# File 'lib/wikibase_representable/model/property.rb', line 14

def id
  @id
end

#labels_hashObject

Returns the value of attribute labels_hash.



14
15
16
# File 'lib/wikibase_representable/model/property.rb', line 14

def labels_hash
  @labels_hash
end

#statements_hashObject

Returns the value of attribute statements_hash.



14
15
16
# File 'lib/wikibase_representable/model/property.rb', line 14

def statements_hash
  @statements_hash
end

#typeObject

Returns the value of attribute type.



14
15
16
# File 'lib/wikibase_representable/model/property.rb', line 14

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



30
31
32
# File 'lib/wikibase_representable/model/property.rb', line 30

def ==(other)
  other.class == self.class && other.state == state
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/wikibase_representable/model/property.rb', line 34

def eql?(other)
  self == other
end

#stateObject



26
27
28
# File 'lib/wikibase_representable/model/property.rb', line 26

def state
  [type, id, data_type, labels_hash, descriptions_hash, alias_groups_hash, statements_hash]
end