Class: DMG::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/dmg/source.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_hashObject (readonly)

class << self



30
31
32
# File 'lib/dmg/source.rb', line 30

def pkgs_hash
  @pkgs_hash
end

Class Method Details

.download_and_combineObject



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