Class: Flagit::Redactor

Inherits:
Object
  • Object
show all
Defined in:
lib/flagit/redactor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lookout) ⇒ Redactor

Returns a new instance of Redactor.



5
6
7
# File 'lib/flagit/redactor.rb', line 5

def initialize(lookout)
  @lookout = lookout
end

Instance Attribute Details

#lookoutObject

Returns the value of attribute lookout.



3
4
5
# File 'lib/flagit/redactor.rb', line 3

def lookout
  @lookout
end

Instance Method Details

#write_content(message, options: { add_commit: { url: true, message: true } }) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/flagit/redactor.rb', line 9

def write_content(message, options: { add_commit: { url: true, message: true } } )
  message if options[:add_commit].nil?
  last_commit = @lookout.last_commit(branch_name: options[:branch])
  message += " -"
  message += " #{last_commit.message}" if (options[:add_commit][:message])
  commit_url = @lookout.repository.remote.url.gsub('.git',"/commit/#{last_commit.sha}")
  message += " #{commit_url}" if options[:add_commit][:url]
end