Class: Phrasing::String

Inherits:
Object
  • Object
show all
Defined in:
lib/phrasing/string.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#valueObject (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_boolObject



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