Permalink
Browse files

Rename Coercion::String.to_class -> Coercion::String.to_constant.

  • Loading branch information...
1 parent 0bb78f7 commit 76ebca4ecbed15f86785f7a9c344ec27d89f1758 @emmanuel emmanuel committed Aug 10, 2011
@@ -14,7 +14,7 @@ class Attribute
#
class Class < Object
primitive ::Class
- coercion_method :to_class
+ coercion_method :to_constant
end # class Class
end # class Attribute
@@ -14,14 +14,14 @@ class String < Object
# Coerce give value to a constant
#
# @example
- # Virtus::Coercion::String.to_class('String') # => String
+ # Virtus::Coercion::String.to_constant('String') # => String
#
# @param [String] value
#
# @return [Object]
#
# @api public
- def self.to_class(value)
+ def self.to_constant(value)
# TODO: add support for namespaced classes like 'Virtus::Attribute::String'
::Object.const_get(value)
end
@@ -1,7 +1,7 @@
require 'spec_helper'
-describe Virtus::Coercion::String, '.to_class' do
- subject { object.to_class(string) }
+describe Virtus::Coercion::String, '.to_constant' do
+ subject { object.to_constant(string) }
let(:object) { described_class }
View
@@ -135,7 +135,7 @@ Gem::Specification.new do |s|
"spec/unit/virtus/coercion/integer/class_methods/to_string_spec.rb",
"spec/unit/virtus/coercion/object/class_methods/method_missing_spec.rb",
"spec/unit/virtus/coercion/string/class_methods/to_boolean_spec.rb",
- "spec/unit/virtus/coercion/string/class_methods/to_class_spec.rb",
+ "spec/unit/virtus/coercion/string/class_methods/to_constant_spec.rb",
"spec/unit/virtus/coercion/string/class_methods/to_date_spec.rb",
"spec/unit/virtus/coercion/string/class_methods/to_datetime_spec.rb",
"spec/unit/virtus/coercion/string/class_methods/to_decimal_spec.rb",

0 comments on commit 76ebca4

Please sign in to comment.