Skip to content

Commit

Permalink
Fix constant namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
joker1007 committed Oct 21, 2014
1 parent 6db7bf8 commit 32dbbbb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/attr_typecastable/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Types

class << self
def typecaster_for(typecaster, **options)
const = typecaster.is_a?(String) ? typecaster.constantize : typecaster
const = typecaster.is_a?(::String) ? typecaster.constantize : typecaster
BASIC_TYPES.fetch(const, const)
rescue NameError
raise TypeCasterNotFound, "#{typecaster} is undefined"
Expand Down
2 changes: 1 addition & 1 deletion lib/attr_typecastable/types/boolean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(**options)
end

def do_typecast(value)
return value if value.is_a?(::TrueClass) || value.is_a?(FalseClass)
return value if value.is_a?(::TrueClass) || value.is_a?(::FalseClass)

true_values = Array(@options[:true_values])
false_values = Array(@options[:false_values])
Expand Down
2 changes: 1 addition & 1 deletion spec/attr_typecastable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class User
typed_attr_accessor :name, String
typed_attr_accessor :default_name, String, default: "Foo"
typed_attr_accessor :not_nil_name, String, allow_nil: false, default: ""
typed_attr_accessor :birthday, Date
typed_attr_accessor :birthday, "Date"
typed_attr_accessor :birthday_time, Time
typed_attr_accessor :birthday_datetime, DateTime
typed_attr_accessor :age, Integer
Expand Down

0 comments on commit 32dbbbb

Please sign in to comment.