Sha256: dd7cbad6c5cdb406ecc25e9aead229fd04f66ea28cb48c39a075b3a6cb2cdf00

Contents?: true

Size: 552 Bytes

Versions: 35

Compression:

Stored size: 552 Bytes

Contents

  module Enumerable
    module ActsAsResourceConcern
      def self.included(base)
        base.extend(ClassMethods)
      end
      
      module ClassMethods
        def collection
          self::COLLECTION
        end

        def all
          collection.collect do |datum|
            new(datum)
          end
        end

        def find(id)
          all.select { |resource| resource.to_param == id }.first
        end

        def first
          all.first
        end

        def count
          all.size
        end
      end
    end
  end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
itsf_backend-5.0.0.pre app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-4.2.3 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-4.2.2 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-4.2.1 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-4.2.0 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-4.0.1 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-4.0.0 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.1.1 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.1.0 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.7 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.6 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.5 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.4 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.3 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.2 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.1 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-3.0.0 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-2.2.1 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-2.2.0 app/concerns/enumerable/acts_as_resource_concern.rb
itsf_backend-2.1.0 app/concerns/enumerable/acts_as_resource_concern.rb