Sha256: a3856a9592254ad59f16b8aedd8b2c519a6f3340b1a1dcd4e4185aafc7ba9308

Contents?: true

Size: 877 Bytes

Versions: 10

Compression:

Stored size: 877 Bytes

Contents

# encoding: utf-8

module Hyperdrive
  module DSL
    class Resource
      include Values
      attr_reader :resource
      def initialize(name, hyperdrive_config)
        @resource = ::Hyperdrive::Resource.new(name, hyperdrive_config)
        instance_eval(&Proc.new) if block_given?
      end

      def name(name)
        resource.name = name
      end

      def description(description)
        resource.description = description
      end

      def param(*args)
        resource.register_param(*args)
      end

      def filter(*args)
        resource.register_filter(*args)
      end

      def request(request_method)
        unless definable_request_methods.include? request_method
          raise Errors::DSL::UnknownArgument.new(request_method, 'request')
        end
        resource.register_request_handler(request_method, Proc.new)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hyperdrive-0.0.15 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.14 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.13 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.12 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.11 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.10 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.9 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.8 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.7 lib/hyperdrive/dsl/resource.rb
hyperdrive-0.0.6 lib/hyperdrive/dsl/resource.rb