Sha256: d84f4a0aac0f30ed451f896b804dd0309a5d589851e6564c5b34d6763848a5b4

Contents?: true

Size: 762 Bytes

Versions: 6

Compression:

Stored size: 762 Bytes

Contents

module EacLauncher
  class Context
    class Settings
      include ::Eac::SimpleCache

      def initialize(file)
        @data = YAML.load_file(file)
      end

      def instance_settings(instance)
        ::EacLauncher::Instances::Settings.new(value(['Instances', instance.to_root_path]))
      end

      private

      def excluded_projects_uncached
        enum_value(%w[Projects Exclude])
      end

      def enum_value(path)
        r = value(path)
        r.is_a?(Enumerable) ? r : []
      end

      def value(path)
        node_value(@data, path)
      end

      def node_value(data, path)
        return data if path.empty?
        return nil unless data.is_a?(Hash)
        node_value(data[path.first], path.drop(1))
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
eac_launcher-0.1.5 lib/eac_launcher/context/settings.rb
eac_launcher-0.1.3 lib/eac_launcher/context/settings.rb
eac_launcher-0.1.4 lib/eac_launcher/context/settings.rb
eac_launcher-0.1.2 lib/eac_launcher/context/settings.rb
eac_launcher-0.1.1 lib/eac_launcher/context/settings.rb
eac_launcher-0.1.0 lib/eac_launcher/context/settings.rb