Class: GitHub::Commit
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- GitHub::Commit
- Defined in:
- lib/github/models/commit.rb
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) author
- - (Object) committer
- - (Object) id
-
- (Commit) initialize(repository = nil, attrs = nil)
constructor
A new instance of Commit.
- - (Object) parents
Constructor Details
- (Commit) initialize(repository = nil, attrs = nil)
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
+ (Object) commits_from_hashes(h, repository)
14 15 16 17 18 |
# File 'lib/github/models/commit.rb', line 14 def self.commits_from_hashes(h, repository) h.inject([]) do |commits, commit_attrs| commits << from_hash(commit_attrs, repository) end end |
+ (Object) from_hash(h, repository)
10 11 12 |
# File 'lib/github/models/commit.rb', line 10 def self.from_hash(h, repository) new(repository, h) end |
Instance Method Details
- (Object) author
28 29 30 |
# File 'lib/github/models/commit.rb', line 28 def User.from_hash(@table[:author]) if @table[:author] end |
- (Object) committer
24 25 26 |
# File 'lib/github/models/commit.rb', line 24 def committer User.from_hash(@table[:committer]) if @table[:committer] end |
- (Object) id
20 21 22 |
# File 'lib/github/models/commit.rb', line 20 def id @table[:id] end |
- (Object) parents
32 33 34 35 36 |
# File 'lib/github/models/commit.rb', line 32 def parents @parents ||= @table[:parents].inject([]) do |commits, parent_attrs| commits << self.repository.commit(parent_attrs['id']) end end |