Sha256: 29ab16872a774319b6686116104204beab2cafd2d48970ced1701e4c661705a0

Contents?: true

Size: 754 Bytes

Versions: 8

Compression:

Stored size: 754 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.name]))
      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

8 entries across 8 versions & 1 rubygems

Version Path
eac_launcher-0.3.2 lib/eac_launcher/context/settings.rb
eac_launcher-0.3.1 lib/eac_launcher/context/settings.rb
eac_launcher-0.3.0 lib/eac_launcher/context/settings.rb
eac_launcher-0.2.2 lib/eac_launcher/context/settings.rb
eac_launcher-0.2.1 lib/eac_launcher/context/settings.rb
eac_launcher-0.2.0 lib/eac_launcher/context/settings.rb
eac_launcher-0.1.7 lib/eac_launcher/context/settings.rb
eac_launcher-0.1.6 lib/eac_launcher/context/settings.rb