Sha256: f8c81ee48a4e0a6115269f358a889c020626eadc903d2b066b57172cd3a13842

Contents?: true

Size: 691 Bytes

Versions: 111

Compression:

Stored size: 691 Bytes

Contents

module Acfs::Model

  # Provides method to check for loading state of resources.
  # A resource that is created but not yet fetched will be loaded
  # after running {Acfs::Global#run Acfs.run}.
  #
  # @example
  #   user = User.find 5
  #   user.loaded? # => false
  #   Acfs.run
  #   user.loaded? # => true
  #
  module Loadable
    extend ActiveSupport::Concern

    # @api public
    #
    # Check if model is loaded or if request is still queued.
    #
    # @return [ Boolean ] True if resource is loaded, false otherwise.
    #
    def loaded?
      !!@loaded
    end

    # @api private
    #
    # Mark model as loaded.
    #
    def loaded!
      @loaded = true
    end
  end
end

Version data entries

111 entries across 111 versions & 1 rubygems

Version Path
acfs-0.42.0 lib/acfs/model/loadable.rb
acfs-0.41.1 lib/acfs/model/loadable.rb
acfs-0.41.1.beta1 lib/acfs/model/loadable.rb
acfs-0.41.0 lib/acfs/model/loadable.rb
acfs-0.40.1.rc1 lib/acfs/model/loadable.rb
acfs-0.40.0 lib/acfs/model/loadable.rb
acfs-0.39.1 lib/acfs/model/loadable.rb
acfs-0.39.0 lib/acfs/model/loadable.rb
acfs-0.38.0 lib/acfs/model/loadable.rb
acfs-0.37.0.1.b295 lib/acfs/model/loadable.rb
acfs-0.37.0 lib/acfs/model/loadable.rb
acfs-0.36.0.1.b293 lib/acfs/model/loadable.rb
acfs-0.36.0 lib/acfs/model/loadable.rb
acfs-0.35.0.1.b291 lib/acfs/model/loadable.rb
acfs-0.35.0 lib/acfs/model/loadable.rb
acfs-0.34.1.1.b289 lib/acfs/model/loadable.rb
acfs-0.34.1 lib/acfs/model/loadable.rb
acfs-0.34.0.1.b288 lib/acfs/model/loadable.rb
acfs-0.34.0.1.b287 lib/acfs/model/loadable.rb
acfs-0.34.0.1.b286 lib/acfs/model/loadable.rb