Class: WikibaseRepresentable::Model::SiteLink

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

Overview

Value object representing a link to a page on another site.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site_id: nil, page_name: nil, badges: nil) ⇒ SiteLink

Returns a new instance of SiteLink.



9
10
11
12
13
# File 'lib/wikibase_representable/model/site_link.rb', line 9

def initialize(site_id: nil, page_name: nil, badges: nil)
  @site_id = site_id
  @page_name = page_name
  @badges = badges
end

Instance Attribute Details

#badgesObject

Returns the value of attribute badges.



7
8
9
# File 'lib/wikibase_representable/model/site_link.rb', line 7

def badges
  @badges
end

#page_nameObject

Returns the value of attribute page_name.



7
8
9
# File 'lib/wikibase_representable/model/site_link.rb', line 7

def page_name
  @page_name
end

#site_idObject

Returns the value of attribute site_id.



7
8
9
# File 'lib/wikibase_representable/model/site_link.rb', line 7

def site_id
  @site_id
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/wikibase_representable/model/site_link.rb', line 19

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/wikibase_representable/model/site_link.rb', line 23

def eql?(other)
  self == other
end

#stateObject



15
16
17
# File 'lib/wikibase_representable/model/site_link.rb', line 15

def state
  [site_id, page_name, badges]
end