Sha256: eca9e91faf0fa5465693958ac6e42451ed534eea8460294d9b30b3ea0f808753

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

require 'active_support/core_ext/module'

module Pears
  module Providers
    class Builder
      delegate :name, to: :subject

      def initialize(subject)
        @subject = subject
      end

      def hash
        raise 'not yet implemented'
      end

      def loco
        raise 'not yet implemented'
      end

      def env
        raise 'not yet implemented'
      end

      def local_file(file_path)
        register Provider::LocalFile.new(file_path)
      end

      def remote_file(file_url)
        register Provider::RemoteFile.new(file_url)
      end

      def subscription &block
        register Provider::Subscription.new(@subject.name, &block)
      end

      private

      def register provider
        return provider unless @subject.is_a? Subject

        @subject.push_layer provider
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pears-0.0.3 lib/pears/provider/builder.rb
pears-0.0.2 lib/pears/provider/builder.rb
pears-0.0.1 lib/pears/provider/builder.rb