Class: Hotspots::Repository::Command::Git::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/hotspots/repository/command/git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Log

Returns a new instance of Log.



8
9
10
11
# File 'lib/hotspots/repository/command/git.rb', line 8

def initialize(options)
  @since_days     = options[:since_days]
  @message_filter = options[:message_filter].to_s
end

Instance Attribute Details

#message_filterObject (readonly)

Returns the value of attribute message_filter.



6
7
8
# File 'lib/hotspots/repository/command/git.rb', line 6

def message_filter
  @message_filter
end

#since_daysObject (readonly)

Returns the value of attribute since_days.



6
7
8
# File 'lib/hotspots/repository/command/git.rb', line 6

def since_days
  @since_days
end

Instance Method Details

#buildObject



13
14
15
# File 'lib/hotspots/repository/command/git.rb', line 13

def build
  "git log --pretty=\"%H\" #{since_clause}#{grep_clause}"
end

#grep_clauseObject



21
22
23
# File 'lib/hotspots/repository/command/git.rb', line 21

def grep_clause
  message_filter.empty? ? "" : " --grep \"#{message_filter}\""
end

#since_clauseObject



17
18
19
# File 'lib/hotspots/repository/command/git.rb', line 17

def since_clause
  "--since=\"#{since_days} days ago\""
end