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.23.2 lib/acfs/model/loadable.rb
acfs-0.23.1.b198 lib/acfs/model/loadable.rb
acfs-0.23.1 lib/acfs/model/loadable.rb
acfs-0.23.0.b197 lib/acfs/model/loadable.rb
acfs-0.22.2.b196 lib/acfs/model/loadable.rb
acfs-0.23.0 lib/acfs/model/loadable.rb
acfs-0.22.2.b194 lib/acfs/model/loadable.rb
acfs-0.22.2.b193 lib/acfs/model/loadable.rb
acfs-0.22.2 lib/acfs/model/loadable.rb
acfs-0.22.1.b192 lib/acfs/model/loadable.rb
acfs-0.22.1 lib/acfs/model/loadable.rb
acfs-0.22.0.b191 lib/acfs/model/loadable.rb
acfs-0.22.0.b190 lib/acfs/model/loadable.rb
acfs-0.22.0 lib/acfs/model/loadable.rb
acfs-0.21.1.b189 lib/acfs/model/loadable.rb
acfs-0.21.1.rc1.b188 lib/acfs/model/loadable.rb
acfs-0.21.1 lib/acfs/model/loadable.rb
acfs-0.21.0.rc1.b187 lib/acfs/model/loadable.rb
acfs-0.21.1.rc1 lib/acfs/model/loadable.rb
acfs-0.21.0.rc1 lib/acfs/model/loadable.rb