lib/pragma/operation/defaults.rb in pragma-0.1.0 vs lib/pragma/operation/defaults.rb in pragma-0.1.1
- old
+ new
@@ -12,27 +12,39 @@
module ClassMethods # :nodoc:
# Returns the decorator class for the current resource (if the inferred class exists).
#
# If the operation name is +API::V1::Post::Operation::Show+, returns
# +API::V1::Post::Decorator+.
+ #
+ # @return [Class]
def decorator_klass
- super || (computed_decorator_klass if class_exists?(computed_decorator_klass))
+ super || (
+ Object.const_get(computed_decorator_klass) if class_exists?(computed_decorator_klass)
+ )
end
# Returns the policy class for the current resource (if the inferred class exists).
#
# If the operation name is +API::V1::Post::Operation::Show+, returns
# +API::V1::Post::Policy+.
+ #
+ # @return [Class]
def policy_klass
- super || (computed_policy_klass if class_exists?(computed_policy_klass))
+ super || (
+ Object.const_get(computed_policy_klass) if class_exists?(computed_policy_klass)
+ )
end
# Returns the contract class for the current resource (if the inferred class exists).
#
# If the operation name is +API::V1::Post::Operation::Create+, returns
# +API::V1::Post::Contract::Create+.
+ #
+ # @return [Class]
def contract_klass
- super || (computed_contract_klass if class_exists?(computed_contract_klass))
+ super || (
+ Object.const_get(computed_contract_klass) if class_exists?(computed_contract_klass)
+ )
end
# Returns the model class for the current resource (if the inferred class exists).
#
# If the operation name is +API::V1::Post::Operation::Create+, returns +::Post+.