Class: WikibaseRepresentable::Model::Property
- Inherits:
-
Object
- Object
- WikibaseRepresentable::Model::Property
- Defined in:
- lib/wikibase_representable/model/property.rb
Overview
Represents a single Wikibase property.
Constant Summary collapse
- ENTITY_TYPE =
'property'
Instance Attribute Summary collapse
-
#alias_groups_hash ⇒ Object
Returns the value of attribute alias_groups_hash.
-
#data_type ⇒ Object
Returns the value of attribute data_type.
-
#descriptions_hash ⇒ Object
Returns the value of attribute descriptions_hash.
-
#id ⇒ Object
Returns the value of attribute id.
-
#labels_hash ⇒ Object
Returns the value of attribute labels_hash.
-
#statements_hash ⇒ Object
Returns the value of attribute statements_hash.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(**kwargs) ⇒ Property
constructor
A new instance of Property.
- #state ⇒ Object
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_hash ⇒ Object
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_type ⇒ Object
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_hash ⇒ Object
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 |
#id ⇒ Object
Returns the value of attribute id.
14 15 16 |
# File 'lib/wikibase_representable/model/property.rb', line 14 def id @id end |
#labels_hash ⇒ Object
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_hash ⇒ Object
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 |
#type ⇒ Object
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
34 35 36 |
# File 'lib/wikibase_representable/model/property.rb', line 34 def eql?(other) self == other end |
#state ⇒ Object
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 |