Sha256: 47bd4f9d7cb3c137c7b826240783c1919d47e792513c416cceed404a1908b6a3

Contents?: true

Size: 724 Bytes

Versions: 7

Compression:

Stored size: 724 Bytes

Contents

module Husky
  class Repo

    class << self

      def find(id)
        entity.new(data_source.find(id))
      end

      def all
        entity.wrap(data_source)
      end

      def build(attributes)
        entity.new(data_source.build(attributes))
      end

      def create(attributes)
        entity.new(data_source.create(attributes))
      end

      def update(item, attributes)
        entity.new(item.update_attributes(attributes))
      end

      def save(item)
        item.save
      end

      def destroy(item)
        item.destroy
      end

      private

      def data_sourse
        raise NotImplementedError
      end

      def entity
        raise NotImplementedError
      end

    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
husky-0.1.3 lib/husky/repo.rb
husky-0.1.2 lib/husky/repo.rb
husky-0.1.1 lib/husky/repo.rb
husky-0.1.0 lib/husky/repo.rb
husky-0.0.9 lib/husky/repo.rb
husky-0.0.8 lib/husky/repo.rb
husky-0.0.7 lib/husky/repo.rb