Class: POChange

Inherits:
Object show all
Includes:
FromHash
Defined in:
lib/transparent_git/repo.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commit_hashObject

Returns the value of attribute commit_hash.



16
17
18
# File 'lib/transparent_git/repo.rb', line 16

def commit_hash
  @commit_hash
end

#currObject

Returns the value of attribute curr.



16
17
18
# File 'lib/transparent_git/repo.rb', line 16

def curr
  @curr
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/transparent_git/repo.rb', line 16

def name
  @name
end

#prevObject

Returns the value of attribute prev.



16
17
18
# File 'lib/transparent_git/repo.rb', line 16

def prev
  @prev
end

#timeObject

Returns the value of attribute time.



16
17
18
# File 'lib/transparent_git/repo.rb', line 16

def time
  @time
end

Class Method Details

.from_diff(commit, diff) ⇒ Object



23
24
25
26
# File 'lib/transparent_git/repo.rb', line 23

def self.from_diff(commit,diff)
  new(:curr => diff.b_blob.andand.data.andand.stripped_chars, :prev => diff.a_blob.andand.data.andand.stripped_chars, 
    :name => diff.a_path, :time => commit.committed_date, :commit_hash => commit.id)
end

Instance Method Details

#to_jsonObject



20
21
22
# File 'lib/transparent_git/repo.rb', line 20

def to_json
  {:curr => curr.andand.strip, :prev => prev.andand.strip, :file => name, :time => time, :commit_hash => commit_hash}
end

#to_sObject



17
18
19
# File 'lib/transparent_git/repo.rb', line 17

def to_s
  "#{name}: #{prev.andand.strip}|#{curr.andand.strip}"
end