Class: ActiveRecord::ConnectionAdapters::Redshift::OID::Bit
- Inherits:
-
Type::Value
- Object
- Type::Value
- ActiveRecord::ConnectionAdapters::Redshift::OID::Bit
- Defined in:
- lib/active_record/connection_adapters/redshift/oid/bit.rb
Overview
:nodoc:
Direct Known Subclasses
Defined Under Namespace
Classes: Data
Instance Method Summary collapse
Instance Method Details
#type ⇒ Object
6 7 8 |
# File 'lib/active_record/connection_adapters/redshift/oid/bit.rb', line 6 def type :bit end |
#type_cast(value) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/active_record/connection_adapters/redshift/oid/bit.rb', line 10 def type_cast(value) if ::String === value case value when /^0x/i value[2..-1].hex.to_s(2) # Hexadecimal notation else value # Bit-string notation end else value end end |
#type_cast_for_database(value) ⇒ Object
23 24 25 |
# File 'lib/active_record/connection_adapters/redshift/oid/bit.rb', line 23 def type_cast_for_database(value) Data.new(super) if value end |