Class: RubocopPr::Repositories::Github::PullRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop_pr/repositories/github.rb

Overview

The representation of the PR

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, **other) ⇒ PullRequest

Returns a new instance of PullRequest.



29
30
31
32
# File 'lib/rubocop_pr/repositories/github.rb', line 29

def initialize(title:, **other)
  @title = title
  @body = other[:body] || ''
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



27
28
29
# File 'lib/rubocop_pr/repositories/github.rb', line 27

def body
  @body
end

#titleObject (readonly)

Returns the value of attribute title.



27
28
29
# File 'lib/rubocop_pr/repositories/github.rb', line 27

def title
  @title
end

Instance Method Details

#createObject



34
35
36
37
# File 'lib/rubocop_pr/repositories/github.rb', line 34

def create
  link = `hub pull-request create -m '#{title}' -m '#{body}'`
  link.split('/').last.to_i
end