Class: Gh::Trending::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/gh_trending/repository.rb

Overview

This class represents a trending repository in the github’s trending repositories page.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: '', description: '', language: '', period_stars: 0, url: '') ⇒ Repository

Period stars correspond to the stars that the repository has in the current period being considered, for example: 283 stars THIS WEEK.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gh_trending/repository.rb', line 9

def initialize(
  name: '',
  description: '',
  language: '',
  period_stars: 0,
  url: ''
)
  @name = name
  @description = description
  @language = language
  @period_stars = period_stars
  @url = url
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/gh_trending/repository.rb', line 6

def description
  @description
end

#languageObject (readonly)

Returns the value of attribute language.



6
7
8
# File 'lib/gh_trending/repository.rb', line 6

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/gh_trending/repository.rb', line 6

def name
  @name
end

#period_starsObject (readonly)

Returns the value of attribute period_stars.



6
7
8
# File 'lib/gh_trending/repository.rb', line 6

def period_stars
  @period_stars
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/gh_trending/repository.rb', line 6

def url
  @url
end

Instance Method Details

#to_hObject



23
24
25
26
27
28
29
30
31
# File 'lib/gh_trending/repository.rb', line 23

def to_h
  {
    name: name,
    description: description,
    language: language,
    period_stars: period_stars,
    url: url
  }
end