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.22.0.rc1.b186 lib/acfs/model/loadable.rb
acfs-0.21.0.b185 lib/acfs/model/loadable.rb
acfs-0.20.0.dev.b184 lib/acfs/model/loadable.rb
acfs-0.21.0 lib/acfs/model/loadable.rb
acfs-0.20.0.dev.b183 lib/acfs/model/loadable.rb
acfs-0.20.0.dev.b182 lib/acfs/model/loadable.rb
acfs-0.20.0.dev.b181 lib/acfs/model/loadable.rb
acfs-0.20.0 lib/acfs/model/loadable.rb
acfs-0.19.0 lib/acfs/model/loadable.rb
acfs-0.18.0 lib/acfs/model/loadable.rb
acfs-0.17.0 lib/acfs/model/loadable.rb