Class: Servicedesk::Config
- Inherits:
-
Object
- Object
- Servicedesk::Config
- Defined in:
- lib/servicedesk/config.rb
Instance Attribute Summary collapse
-
#architecture ⇒ Object
Returns the value of attribute architecture.
-
#built_on ⇒ Object
Returns the value of attribute built_on.
-
#ext ⇒ Object
Returns the value of attribute ext.
-
#file ⇒ Object
Returns the value of attribute file.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(package, built_on, url) ⇒ Config
constructor
A new instance of Config.
- #parse(package) ⇒ Object
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
#architecture ⇒ Object
Returns the value of attribute architecture.
4 5 6 |
# File 'lib/servicedesk/config.rb', line 4 def architecture @architecture end |
#built_on ⇒ Object
Returns the value of attribute built_on.
4 5 6 |
# File 'lib/servicedesk/config.rb', line 4 def built_on @built_on end |
#ext ⇒ Object
Returns the value of attribute ext.
4 5 6 |
# File 'lib/servicedesk/config.rb', line 4 def ext @ext end |
#file ⇒ Object
Returns the value of attribute file.
4 5 6 |
# File 'lib/servicedesk/config.rb', line 4 def file @file end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/servicedesk/config.rb', line 4 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/servicedesk/config.rb', line 4 def url @url end |
#version ⇒ Object
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 |