Class: GithubContributions::GithubObject

Inherits:
Object
  • Object
show all
Defined in:
lib/github_contributions/github_object.rb

Overview

call these payloads?

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ GithubObject

Returns a new instance of GithubObject.



6
7
8
# File 'lib/github_contributions/github_object.rb', line 6

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/github_contributions/github_object.rb', line 4

def data
  @data
end

Instance Method Details

#eql?(other) ⇒ Boolean

ContributionGrouper uses these objects as keys in a hash We need to define the ‘hash` and `eql?` so they work correctly

Returns:

  • (Boolean)


16
17
18
# File 'lib/github_contributions/github_object.rb', line 16

def eql?(other)
  hash == other.hash
end

#hashObject



20
21
22
# File 'lib/github_contributions/github_object.rb', line 20

def hash
  data.html_url.hash
end

#userObject



10
11
12
# File 'lib/github_contributions/github_object.rb', line 10

def user
  GithubObjects::User.new(data.user)
end