Class: Jammer::PackageInfo
- Inherits:
-
Object
- Object
- Jammer::PackageInfo
- Defined in:
- lib/jammer/package_info.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(package_name, package_desc, package_url, package_version = nil) ⇒ PackageInfo
constructor
A new instance of PackageInfo.
- #on_github? ⇒ Boolean
- #repo_type ⇒ Object
- #repo_url ⇒ Object
Constructor Details
#initialize(package_name, package_desc, package_url, package_version = nil) ⇒ PackageInfo
Returns a new instance of PackageInfo.
5 6 7 |
# File 'lib/jammer/package_info.rb', line 5 def initialize(package_name, package_desc, package_url, package_version = nil) @name, @description, @version, @url = package_name, package_desc, package_version, package_url end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/jammer/package_info.rb', line 3 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/jammer/package_info.rb', line 3 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/jammer/package_info.rb', line 3 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/jammer/package_info.rb', line 3 def version @version end |
Class Method Details
.fromJSON(json_string) ⇒ Object
21 22 23 24 |
# File 'lib/jammer/package_info.rb', line 21 def self.fromJSON(json_string) package = JSON.parse json_string new(package['name'], package['description'], nil, package['version']) end |
Instance Method Details
#on_github? ⇒ Boolean
17 18 19 |
# File 'lib/jammer/package_info.rb', line 17 def on_github? url.include? 'github.com' end |
#repo_type ⇒ Object
13 14 15 |
# File 'lib/jammer/package_info.rb', line 13 def repo_type on_github? ? 'git' : '' end |
#repo_url ⇒ Object
9 10 11 |
# File 'lib/jammer/package_info.rb', line 9 def repo_url on_github? ? "#{url}.git" : '' end |