lib/hexx/models/base_coercer.rb in hexx-2.2.0 vs lib/hexx/models/base_coercer.rb in hexx-3.0.0
- old
+ new
@@ -1,11 +1,19 @@
module Hexx
module Models
- # Coerces PORO attribute's getter and setter with given type.
+ # @api hide
+ # Coerces class attribute getter and setter with given type.
class BaseCoercer < Struct.new(:klass, :name, :type)
# Coerces class attribute's getter and setter.
+ #
+ # @example
+ # BaseCoercer.new SomeModel, :name, StrippedString
+ # BaseCoercer.coerce
+ #
+ # model = SomeModel.new name: "string"
+ # model.name.class # => StrippedString
def coerce
coerce_setter
coerce_getter
end