Object
Coercer object
@example
coercer = Coercible::Coercer.new coercer[String].to_boolean('yes') # => true coercer[Integer].to_string(1) # => '1'
@api public
Build a new coercer
@example
Coercible::Coercer.new { |config| # set configuration }
@yieldparam [Configuration]
@return [Coercer]
@api public
# File lib/coercible/coercer.rb, line 41 def self.new(&block) configuration = Configuration.build(config_keys) configurable_coercers.each do |coercer| configuration.send("#{coercer.config_name}=", coercer.config) end yield(configuration) if block_given? super(configuration) end
Access a specific coercer object for the given type
@example
coercer[String] # => string coercer coercer[Integer] # => integer coercer
@param [Class] type
@return [Coercer::Object]
@api public
# File lib/coercible/coercer.rb, line 101 def [](klass) coercers[klass] || initialize_coercer(klass) end
Generated with the Darkfish Rdoc Generator 2.