Permalink
Browse files

Moved the login in #get back into #predefined_resource.

  • Loading branch information...
postmodern committed Jul 24, 2011
1 parent 5668a4e commit 47dbac05b7a313394f099b3cf3e8904eaa073b23
Showing with 4 additions and 9 deletions.
  1. +4 −9 lib/dm-is-predefined/is/predefined.rb
@@ -76,19 +76,16 @@ def predefined?(name)
# Indicates that there are no predefined attributes for the
# resource with the given name.
#
- # @deprecated
- # Please use {#get} instead. This method will be removed in 1.0.0.
- #
# @since 0.2.1
#
def predefined_resource(name)
name = name.to_sym
- if predefined?(name)
- get(name)
- else
+ unless predefined?(name)
raise(UnknownResource,"The resource '#{name}' was not predefined")
end
+
+ return first_or_create(predefined_attributes[name])
end
#
@@ -155,9 +152,7 @@ def predefined_resource_with(query={})
def get(key)
case key
when Symbol
- if (attributes = predefined_attributes[key])
- first_or_create(attributes)
- end
+ predefined_resource(key)
else
super(key)
end

0 comments on commit 47dbac0

Please sign in to comment.