Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #20 from emmanuel/feature/rename_to_class_coercion

Rename Coercion::String.to_class -> Coercion::String.to_constant
  • Loading branch information...
commit 3395b2bff1d28ac6c386168150d7134c586e2012 2 parents 0bb78f7 + 76ebca4
@solnic authored
View
2  lib/virtus/attribute/class.rb
@@ -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
View
4 lib/virtus/coercion/string.rb
@@ -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
View
4 ...us/coercion/string/class_methods/to_class_spec.rb → ...coercion/string/class_methods/to_constant_spec.rb
@@ -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
2  virtus.gemspec
@@ -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",
Please sign in to comment.
Something went wrong with that request. Please try again.