Class: Hackmac::KextDownload
- Inherits:
-
Object
- Object
- Hackmac::KextDownload
- Includes:
- Tins::StringVersion
- Defined in:
- lib/hackmac/kext_download.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #download_asset ⇒ Object
-
#initialize(name, version, url) ⇒ KextDownload
constructor
A new instance of KextDownload.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, version, url) ⇒ KextDownload
Returns a new instance of KextDownload.
8 9 10 11 12 |
# File 'lib/hackmac/kext_download.rb', line 8 def initialize(name, version, url) @name = name @url = url @version = Version.new(version) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/hackmac/kext_download.rb', line 14 def name @name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
16 17 18 |
# File 'lib/hackmac/kext_download.rb', line 16 def version @version end |
Instance Method Details
#download_asset ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/hackmac/kext_download.rb', line 18 def download_asset data = URI.open( @url, 'Accept' => 'application/octet-stream', &:read ) return File.basename(@url), data end |
#inspect ⇒ Object
27 28 29 |
# File 'lib/hackmac/kext_download.rb', line 27 def inspect "#<#{self.class}: #{to_s}>" end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/hackmac/kext_download.rb', line 31 def to_s "#{name} #{version}" end |