Class: Grit::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/grit_service/grit/git.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(cmd, options = {}, *args, &block) ⇒ Object

not sure why I need to do this but doing it on console commands returned correct results…



50
51
52
# File 'lib/grit_service/grit/git.rb', line 50

def method_missing(cmd, options = {}, *args, &block)
  native(cmd, options, *args)
end

Class Method Details

.service(method) ⇒ Object



3
4
5
6
7
# File 'lib/grit_service/grit/git.rb', line 3

def self.service(method)
  define_method(method) do |*args|
    GritService.bertrpc.call.git.send(method, *([self.git_dir, args].flatten))
  end
end

Instance Method Details

#native(cmd, options = {}, *args, &block) ⇒ Object

override native to send rpc



44
45
46
# File 'lib/grit_service/grit/git.rb', line 44

def native(cmd, options = {}, *args, &block)
  GritService.bertrpc.call.git.native(self.git_dir, cmd, options, *args)
end