Class: Phrasing::String
- Inherits:
-
Object
- Object
- Phrasing::String
- Defined in:
- lib/phrasing/string.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ String
constructor
A new instance of String.
- #to_bool ⇒ Object
Constructor Details
#initialize(value) ⇒ String
Returns a new instance of String.
5 6 7 |
# File 'lib/phrasing/string.rb', line 5 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/phrasing/string.rb', line 3 def value @value end |
Instance Method Details
#to_bool ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/phrasing/string.rb', line 9 def to_bool if major_version >= 5 ActiveModel::Type::Boolean.new.cast(value) elsif major_version == 4 && minor_version >= 2 ActiveRecord::Type::Boolean.new.type_cast_from_database(value) else ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value) end end |