Sha256: 65ff5898db8b24168a5b5df6466eff1741c7d050f85d71f6be29086509078259

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

class MotionSplash
  class Config
    def initialize(app = nil)
      @app = app
      @properties_set = []
    end

    def info_plist
      @info_plist ||= begin
        if @app
          @app.info_plist
        else
          NSBundle.mainBundle.infoDictionary
        end
      rescue
        {}
      end
    end

    PROPERTIES = {
        controller_class: "SplashController",
        images_dir: File.join(Dir.pwd,"resources"),
        app_delegate_file: File.join(Dir.pwd, "app", "app_delegate.rb"),
        sizes: [[[320, 480], 1], [[320, 480], 2], [[320, 568], 2], [[375, 667], 2], [[414, 736], 3]],
        image_name: "Default",
        exclude_scales: [],
        exclude_sizes: [],
        custom_sizes: []
    }

    def prefix
      "_splash_"
    end

    PROPERTIES.keys.each do |property|
      define_method("#{property}=") do |value|
        info_plist["#{prefix}#{property}"] = value
        @properties_set << property
      end

      define_method(property) do
        info_plist["#{prefix}#{property}"]
      end
    end

    def finish
      (PROPERTIES.keys - @properties_set.dup).each do |property|
        default_value = PROPERTIES[property]
        info_plist["#{prefix}#{property}"] = default_value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-splash-1.0 lib/motion-splash/config.rb