lib/jarl/jarl_file.rb in jarl-0.2.0 vs lib/jarl/jarl_file.rb in jarl-0.3.0

- old
+ new

@@ -1,21 +1,26 @@ require 'yaml' require 'pathname' module Jarl class JarlFile - attr_reader :path, :name, :applications + attr_reader :path, :name def initialize(path) - @path = Pathname.new(path) + @path = Pathname.new(path).expand_path @name = @path.basename('.jarl') - load end + def applications + @applications ||= load_applications + end + private - def load - @applications = YAML.load File.read(path) + def load_applications + YAML.load(File.read(path)).map do |app_name, params| + Application.new(name, app_name, params) + end end end # class JarlFile end # module Jarl