Permalink
Browse files

Merge pull request #15387 from sgrif/sg-remove-column-coder

Remove unused `Column#coder`
  • Loading branch information...
spastorino committed May 28, 2014
2 parents 9ae3f5f + 748f070 commit 7fcbc3681eeb7b7e093fba47c5b881c932219bdd
@@ -14,12 +14,9 @@ module Format
end
attr_reader :name, :default, :cast_type, :null, :sql_type, :default_function
- attr_accessor :coder
-
- alias :encoded? :coder
delegate :type, :precision, :scale, :limit, :klass, :text?, :number?, :binary?,
- :type_cast_for_write, :type_cast_for_database, to: :cast_type
+ :type_cast, :type_cast_for_write, :type_cast_for_database, to: :cast_type
# Instantiates a new column in the table.
#
@@ -37,22 +34,12 @@ def initialize(name, default, cast_type, sql_type = nil, null = true)
@null = null
@default = extract_default(default)
@default_function = nil
- @coder = nil
end
def has_default?
!default.nil?
end
- # Casts value to an appropriate instance.
- def type_cast(value)
- if encoded?
- coder.load(value)
- else
- cast_type.type_cast(value)
- end
- end
-
# Returns the human name of the column name.
#
# ===== Examples
@@ -11,26 +11,6 @@ def @adapter.native_database_types
@viz = @adapter.schema_creation
end
- def test_can_set_coder
- column = Column.new("title", nil, Type::String.new, "varchar(20)")
- column.coder = YAML
- assert_equal YAML, column.coder
- end
-
- def test_encoded?
- column = Column.new("title", nil, Type::String.new, "varchar(20)")
- assert !column.encoded?
-
- column.coder = YAML
- assert column.encoded?
- end
-
- def test_type_case_coded_column
- column = Column.new("title", nil, Type::String.new, "varchar(20)")
- column.coder = YAML
- assert_equal "hello", column.type_cast("--- hello")
- end
-
# Avoid column definitions in create table statements like:
# `title` varchar(255) DEFAULT NULL
def test_should_not_include_default_clause_when_default_is_null

0 comments on commit 7fcbc36

Please sign in to comment.