Class: Servicedesk::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package, built_on, url) ⇒ Config

Returns a new instance of Config.



6
7
8
9
10
11
12
# File 'lib/servicedesk/config.rb', line 6

def initialize(package, built_on, url)
	puts "in config initialize"
  @file 			= package
	@built_on 	= built_on
	@url				= url
	parse(package)
end

Instance Attribute Details

#architectureObject

Returns the value of attribute architecture.



4
5
6
# File 'lib/servicedesk/config.rb', line 4

def architecture
  @architecture
end

#built_onObject

Returns the value of attribute built_on.



4
5
6
# File 'lib/servicedesk/config.rb', line 4

def built_on
  @built_on
end

#extObject

Returns the value of attribute ext.



4
5
6
# File 'lib/servicedesk/config.rb', line 4

def ext
  @ext
end

#fileObject

Returns the value of attribute file.



4
5
6
# File 'lib/servicedesk/config.rb', line 4

def file
  @file
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/servicedesk/config.rb', line 4

def name
  @name
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/servicedesk/config.rb', line 4

def url
  @url
end

#versionObject

Returns the value of attribute version.



4
5
6
# File 'lib/servicedesk/config.rb', line 4

def version
  @version
end

Instance Method Details

#parse(package) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/servicedesk/config.rb', line 14

def parse(package)
	captures = package.match(/.*\/(?<name>[^_]+)[_|-](?<version>[^_]+)[_|-](?<arch>[^\.]+)\.(?<ext>\S+)\z/i)
		@name 				= "#{captures[:name]}"
		@version 			= "#{captures[:version]}"
		@architecture = "#{captures[:arch]}"
		@ext 					= "#{captures[:ext]}"
end