class ActiveRecord::ConnectionAdapters::SQLServer::Type::Data

Attributes

type[R]
value[R]

Public Class Methods

from_msgpack_ext(string) click to toggle source
# File lib/active_record/connection_adapters/sqlserver/type/data.rb, line 40
def self.from_msgpack_ext(string)
  type, value = string.chomp!("msgpack_ext").split(',')

  Data.new(value, type.constantize)
end
new(value, type) click to toggle source
# File lib/active_record/connection_adapters/sqlserver/type/data.rb, line 12
def initialize(value, type)
  @value, @type = value, type
end

Public Instance Methods

==(other)
Alias for: eql?
eql?(other) click to toggle source
# File lib/active_record/connection_adapters/sqlserver/type/data.rb, line 29
def eql?(other)
  # Support comparing `Type::Char`, `Type::Varchar` and `VarcharMax` with strings.
  # This happens when we use enum with string columns.
  if other.is_a?(::String)
    return type.is_a?(ActiveRecord::ConnectionAdapters::SQLServer::Type::String) && value == other
  end

  self.class == other.class && value == other.value
end
Also aliased as: ==
inspect() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/type/data.rb, line 25
def inspect
  @value.inspect
end
quoted() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/type/data.rb, line 16
def quoted
  type.quoted(@value)
end
to_msgpack_ext() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/type/data.rb, line 46
def to_msgpack_ext
  [type.class.to_s, value].join(',') + "msgpack_ext"
end
to_s() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/type/data.rb, line 20
def to_s
  @value
end
Also aliased as: to_str
to_str()
Alias for: to_s