Class: GhDraftIssueConverter::Repository

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(full_repository_name) ⇒ Repository

Returns a new instance of Repository.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/gh_draft_issues_converter/gh_draft_issues_converter.rb', line 53

def initialize(full_repository_name)
  parts = full_repository_name.split('/')

  if full_repository_name.include?('/')
    parts = full_repository_name.split('/')

    if parts.length != 2
      puts "repository_name is invalid"
      exit 1
    elsif parts[0].empty? || parts[1].empty?
      puts "repository_name is invalid"
      exit 1
    else
      # OK
    end
  else
    puts "repository_name is invalid"
    exit 1
  end

  @full_repository_name = full_repository_name
end

Instance Attribute Details

#full_repository_nameObject (readonly)

Returns the value of attribute full_repository_name.



52
53
54
# File 'lib/gh_draft_issues_converter/gh_draft_issues_converter.rb', line 52

def full_repository_name
  @full_repository_name
end

Instance Method Details

#nameObject



76
77
78
# File 'lib/gh_draft_issues_converter/gh_draft_issues_converter.rb', line 76

def name
  full_repository_name.split("/")[1]
end

#ownerObject



80
81
82
# File 'lib/gh_draft_issues_converter/gh_draft_issues_converter.rb', line 80

def owner
  full_repository_name.split("/")[0]
end