Class: GitHub::Commit
- Defined in:
- lib/github/models/commit.rb
Class Method Summary collapse
Instance Method Summary collapse
- #author ⇒ Object
- #committer ⇒ Object
- #id ⇒ Object
-
#initialize(repository = nil, attrs = nil) ⇒ Commit
constructor
A new instance of Commit.
- #parents ⇒ Object
Constructor Details
#initialize(repository = nil, attrs = nil) ⇒ Commit
Returns a new instance of Commit.
5 6 7 8 |
# File 'lib/github/models/commit.rb', line 5 def initialize(repository = nil, attrs = nil) super(attrs) self.repository = repository end |
Class Method Details
.commits_from_hashes(h, repository) ⇒ Object
14 15 16 |
# File 'lib/github/models/commit.rb', line 14 def self.commits_from_hashes(h, repository) h.map { |commit_attrs| from_hash(commit_attrs, repository) } end |
.from_hash(h, repository) ⇒ Object
10 11 12 |
# File 'lib/github/models/commit.rb', line 10 def self.from_hash(h, repository) new(repository, h) end |
Instance Method Details
#author ⇒ Object
26 27 28 |
# File 'lib/github/models/commit.rb', line 26 def User.from_hash(@table[:author]) if @table[:author] end |
#committer ⇒ Object
22 23 24 |
# File 'lib/github/models/commit.rb', line 22 def committer User.from_hash(@table[:committer]) if @table[:committer] end |
#id ⇒ Object
18 19 20 |
# File 'lib/github/models/commit.rb', line 18 def id @table[:id] end |
#parents ⇒ Object
30 31 32 33 34 |
# File 'lib/github/models/commit.rb', line 30 def parents @parents ||= @table[:parents].map do |parent_attrs| repository.commit(parent_attrs['id']) end end |