Class: Janky::GitHub::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/janky/github/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sha1, url, message, author, time) ⇒ Commit

Returns a new instance of Commit.



4
5
6
7
8
9
10
# File 'lib/janky/github/commit.rb', line 4

def initialize(sha1, url, message, author, time)
  @sha1    = sha1
  @url     = url
  @message = message
  @author  = author
  @time    = time
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



12
13
14
# File 'lib/janky/github/commit.rb', line 12

def author
  @author
end

#messageObject (readonly)

Returns the value of attribute message.



12
13
14
# File 'lib/janky/github/commit.rb', line 12

def message
  @message
end

#sha1Object (readonly)

Returns the value of attribute sha1.



12
13
14
# File 'lib/janky/github/commit.rb', line 12

def sha1
  @sha1
end

#urlObject (readonly)

Returns the value of attribute url.



12
13
14
# File 'lib/janky/github/commit.rb', line 12

def url
  @url
end

Instance Method Details

#committed_atObject



14
15
16
# File 'lib/janky/github/commit.rb', line 14

def committed_at
  @time
end

#to_hashObject



18
19
20
21
22
23
24
# File 'lib/janky/github/commit.rb', line 18

def to_hash
  { :id        => @sha1,
    :url       => @url,
    :message   => @message,
    :author    => {:name => @author},
    :timestamp => @time }
end