Class: Lafcadio::StringField
- Inherits:
-
ObjectField
- Object
- ObjectField
- Lafcadio::StringField
- Defined in:
- lib/lafcadio/objectField.rb
Overview
A StringField is expected to contain a string value.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ObjectField
#db_field_name, #domain_class, #mock_value, #name, #not_nil
Class Method Summary collapse
-
.mock_value ⇒ Object
:nodoc:.
Instance Method Summary collapse
Methods inherited from ObjectField
#<=>, #bind_write?, create_from_xml, create_with_args, creation_parameters, #db_column, #db_will_automatically_write?, #default_mock_value, #initialize, #prev_value, #process_before_verify, #value_from_sql, value_type, #verify, #verify_non_nil_value
Constructor Details
This class inherits a constructor from Lafcadio::ObjectField
Class Method Details
.mock_value ⇒ Object
:nodoc:
328 329 330 |
# File 'lib/lafcadio/test.rb', line 328 def StringField.mock_value #:nodoc: 'test text' end |
Instance Method Details
#value_for_sql(value) ⇒ Object
132 133 134 135 136 137 138 139 140 |
# File 'lib/lafcadio/objectField.rb', line 132 def value_for_sql(value) if value value = value.gsub(/(\\?')/) { |m| m.length == 1 ? "''" : m } value = value.gsub(/\\/) { '\\\\' } "'#{value}'" else "null" end end |