Sha256: 558cc2c11da2784b70107af6e67df673ca68b39da089a40751ed4795daa6e000

Contents?: true

Size: 527 Bytes

Versions: 4

Compression:

Stored size: 527 Bytes

Contents

module CDQ

  class CDQModelManager

    attr_writer :current

    def initialize(opts = {})
      @config = opts[:config] || CDQConfig.default
    end

    def current
      @current ||= load_model
    end

    def invalid?
      !@current && @config.model_url.nil?
    end

    private

    def load_model
      if invalid?
        raise "No model file.  Cannot create an NSManagedObjectModel without one."
      else
        NSManagedObjectModel.alloc.initWithContentsOfURL(@config.model_url)
      end
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cdq-0.1.6 motion/cdq/model.rb
cdq-0.1.5 motion/cdq/model.rb
cdq-0.1.2 motion/cdq/model.rb
cdq-0.1.1 motion/cdq/model.rb