Class: Cejo::Floss::ProjectInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/cejo/floss/project_info.rb

Overview

Provides Project Information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, language) ⇒ ProjectInfo

Returns a new instance of ProjectInfo.



12
13
14
15
16
17
18
# File 'lib/cejo/floss/project_info.rb', line 12

def initialize(url, language)
  @url = URI.parse url
  @language = language
  @name = File.basename(@url.path.split('/').last, '.git')
  projects = Pathname.new(File.join(Dir.home, 'Projects'))
  @folder = projects.join language, name
end

Instance Attribute Details

#folderObject (readonly)

Returns the value of attribute folder.



10
11
12
# File 'lib/cejo/floss/project_info.rb', line 10

def folder
  @folder
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/cejo/floss/project_info.rb', line 10

def name
  @name
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/cejo/floss/project_info.rb', line 10

def url
  @url
end

Instance Method Details

#to_sObject



20
21
22
23
24
25
# File 'lib/cejo/floss/project_info.rb', line 20

def to_s
  <<~INFO
    repository: #{url}
    folder: #{folder}
  INFO
end