Class: GoApiClient::Commit

Inherits:
Object
  • Object
show all
Includes:
Helpers::SimpleAttributesSupport
Defined in:
lib/go_api_client/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, attributes = {}) ⇒ Commit

Returns a new instance of Commit.



8
9
10
11
# File 'lib/go_api_client/commit.rb', line 8

def initialize(root, attributes={})
  @root = root
  super(attributes)
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/go_api_client/commit.rb', line 4

def message
  @message
end

#revisionObject

Returns the value of attribute revision.



4
5
6
# File 'lib/go_api_client/commit.rb', line 4

def revision
  @revision
end

#timeObject

Returns the value of attribute time.



4
5
6
# File 'lib/go_api_client/commit.rb', line 4

def time
  @time
end

#userObject

Returns the value of attribute user.



4
5
6
# File 'lib/go_api_client/commit.rb', line 4

def user
  @user
end

Instance Method Details

#parse!Object



13
14
15
16
17
18
19
20
# File 'lib/go_api_client/commit.rb', line 13

def parse!
  self.revision = @root.xpath("./revision").first.content
  self.message  = @root.xpath("./message").first.content
  self.time     = Time.parse(@root.xpath("./checkinTime").first.content).utc
  self.user     = User.parse(@root.xpath("./user").first.content)
  @root         = nil
  self
end

#to_sObject



22
23
24
25
26
27
28
# File 'lib/go_api_client/commit.rb', line 22

def to_s
"commit #{revision}
Author: #{user}
Date:   #{time}

#{message.each_line.collect {|l| "    #{l}"}}"
end