Sha256: b129e8ced95195f5fa6ad6d6b23c3d175ad33b20a89b76e8e49d4788ab605433
Contents?: true
Size: 1.18 KB
Versions: 9
Compression:
Stored size: 1.18 KB
Contents
# encoding: utf-8 require 'hyperdrive/dsl/resource' module Hyperdrive module DSL include Values extend self attr_reader :config, :resources def instance @config ||= default_config.dup @resources ||= {} self end private def name(name) @config[:name] = name end def description(description) @config[:description] = description end def vendor(vendor) @config[:vendor] = vendor end def media_types(media_types) @config[:media_types] = media_types end def cors(options = {}) allowed_options = default_cors_options.keys options = Utils.sanitize_keys(allowed_options, options) @config[:cors] = config[:cors].merge(options) end def per_page(per_page) @config[:per_page] = per_page.to_i end def resource(name) @resources[name] = Resource.new(name, @config, &Proc.new).resource end def reset! # not terribly useful outside of a test environment :( @config = default_config.dup @resources = {} end end end def hyperdrive(&block) Hyperdrive::DSL.instance.instance_eval(&block) if block_given? Hyperdrive::DSL.instance end
Version data entries
9 entries across 9 versions & 1 rubygems