Sha256: 81ebb1268d0345b0a631e524995b0d394372d3499a8ee2f2f00c8d436da48bba
Contents?: true
Size: 839 Bytes
Versions: 1
Compression:
Stored size: 839 Bytes
Contents
module Smooth module Dsl # Creates or opens an API definition def api name, *args, &block Smooth.current_api_name = name instance = Smooth.fetch_api(name) do |key| options = args.dup.extract_options! Smooth::Api.new(name, options).tap do |obj| obj.instance_eval(&block) if block_given? end end instance end # Creates or opens a resource definition def resource name, *args, &block options = args.extract_options! api = case when options[:api].is_a?(Symbol) || options[:api].is_a?(String) Smooth.fetch_api(options[:api]) when options[:api].is_a?(Smooth::Api) options[:api] else Smooth.current_api end api.resource(name, options, &block) end end end extend(Smooth::Dsl)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smooth-2.0.1 | lib/smooth/dsl.rb |