Class: DMG::Source
- Inherits:
-
Object
- Object
- DMG::Source
- Defined in:
- lib/dmg/source.rb
Instance Attribute Summary collapse
-
#pkgs_hash ⇒ Object
readonly
class << self.
Class Method Summary collapse
Instance Method Summary collapse
-
#get(path_or_url) ⇒ Object
Return content from path or url.
-
#initialize(path_or_url) ⇒ Source
constructor
A new instance of Source.
Constructor Details
#initialize(path_or_url) ⇒ Source
Returns a new instance of Source.
32 33 34 |
# File 'lib/dmg/source.rb', line 32 def initialize(path_or_url) @pkgs_hash = YAML.load(get(path_or_url)) end |
Instance Attribute Details
#pkgs_hash ⇒ Object (readonly)
class << self
30 31 32 |
# File 'lib/dmg/source.rb', line 30 def pkgs_hash @pkgs_hash end |
Class Method Details
.download_and_combine ⇒ Object
7 8 9 |
# File 'lib/dmg/source.rb', line 7 def download_and_combine combine(Source.all) end |
Instance Method Details
#get(path_or_url) ⇒ Object
Return content from path or url
37 38 39 40 41 42 43 44 |
# File 'lib/dmg/source.rb', line 37 def get(path_or_url) case path_or_url when /^http(s):\/\// get_file(path_or_url) else read_file(path_or_url) end end |