lib/acfs/service.rb in acfs-1.0.0.dev.1.b305 vs lib/acfs/service.rb in acfs-1.0.0

- old
+ new

@@ -1,9 +1,8 @@ require 'acfs/service/middleware' module Acfs - # User {Acfs::Service} to define your services. That includes # an identity used to identify the service in configuration files # and middlewares the service uses. # # Configure your service URLs in a YAML file loaded in an @@ -33,18 +32,18 @@ # @api private # @return [Location] # def location(resource_class, opts = {}) - opts.reverse_merge! self.options + opts.reverse_merge! options action = opts[:action] || :list - path = if Hash === opts[:path] && opts[:path].has_key?(action) + path = if opts[:path].is_a?(Hash) && opts[:path].key?(action) opts[:path].fetch(action) else - path = if Hash === opts[:path] + path = if opts[:path].is_a?(Hash) opts[:path][:all].to_s else opts[:path].to_s end @@ -57,11 +56,10 @@ Location.new [self.class.base_url.to_s, path.to_s].join('/') end class << self - # @api public # # @overload identity() # Return configured identity key or derive key from class name. # @@ -81,10 +79,10 @@ # @api private # @return [String] # def base_url unless (base = Acfs::Configuration.current.locate identity) - raise ArgumentError, "#{identity} not configured. Add `locate '#{identity.to_s.underscore}', 'http://service.url/'` to your configuration." + raise ArgumentError.new "#{identity} not configured. Add `locate '#{identity.to_s.underscore}', 'http://service.url/'` to your configuration." end base.to_s end end