module Hashie::Extensions::Dash::Coercion
Adds per-property coercion to a Dash.
@example
klass = Class.new(Hashie::Dash) do include Hashie::Extensions::Dash::Coercion property :count, coerce: Integer end klass.new(count: '3').count # => 3
Public Class Methods
included(base)
click to toggle source
Extends a Dash with the ability to define coercion for properties.
@example
klass = Class.new(Hashie::Dash) do include Hashie::Extensions::Dash::Coercion property :count, coerce: Integer end klass.new(count: '3').count # => 3
# File lib/hashie/extensions/dash/coercion.rb, line 23 def self.included(base) base.send :include, Hashie::Extensions::Coercion base.extend ClassMethods end