Class: Ro::Git::Patch

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Patch

Returns a new instance of Patch.



158
159
160
161
162
163
164
165
166
167
168
# File 'lib/ro/git.rb', line 158

def initialize(*args)
  options = Map.options_for!(args)

  self.class.fattrs.each do |key|
    send(key, options.get(key)) if options.has?(key)
  end

  unless args.empty?
    self.data = args.join
  end
end

Instance Method Details

#save(path) ⇒ Object



170
171
172
173
174
175
# File 'lib/ro/git.rb', line 170

def save(path)
  return false unless data
  path = path.to_s
  FileUtils.mkdir_p(File.dirname(path))
  IO.binwrite(path, data)
end