Method: Hub::Context::GitReader#initialize
- Defined in:
- lib/hub/context.rb
#initialize(executable = nil, &read_proc) ⇒ GitReader
Returns a new instance of GitReader.
17 18 19 20 21 22 23 24 25 |
# File 'lib/hub/context.rb', line 17 def initialize(executable = nil, &read_proc) @executable = executable || 'git' # caches output when shelling out to git read_proc ||= lambda { |cache, cmd| result = %x{#{command_to_string(cmd)} 2>#{NULL}}.chomp cache[cmd] = $?.success? && !result.empty? ? result : nil } @cache = Hash.new(&read_proc) end |