Module: Pod4::TypeCasting
- Defined in:
- lib/pod4/typecasting.rb
Overview
A mixin to give you some more options to control how Pod4 maps the interface to the model.
Eventually we will actually have typecasting in here. For now all this allows you to do is enforce an encoding – which will be of use if you are dealing with MSSQL, or with certain interfaces which appear to deal with the code page poorly:
class FOo < Pod4::Model
include Pod4::TypeCasting
force_encoding Encoding::UTF-8
...
end
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
A little bit of magic, for which I apologise.
Class Method Details
.included(base) ⇒ Object
A little bit of magic, for which I apologise.
When you include this module it actually adds the methods in ClassMethods to the class as if you had called ‘extend TypeCasting:ClassMethds` AND adds the methods in InstanceMethods as if you had written `prepend TypeCasting::InstanceMethods`.
In my defence: I didn’t want to have to make you remember to do that…
34 35 36 37 |
# File 'lib/pod4/typecasting.rb', line 34 def self.included(base) base.extend ClassMethods base.send(:prepend, InstanceMethods) end |