Module: Necromancer

Defined in:
lib/necromancer.rb,
lib/necromancer/context.rb,
lib/necromancer/version.rb,
lib/necromancer/converter.rb,
lib/necromancer/conversions.rb,
lib/necromancer/configuration.rb,
lib/necromancer/null_converter.rb,
lib/necromancer/converters/hash.rb,
lib/necromancer/converters/array.rb,
lib/necromancer/converters/range.rb,
lib/necromancer/conversion_target.rb,
lib/necromancer/converters/boolean.rb,
lib/necromancer/converters/numeric.rb,
lib/necromancer/converters/date_time.rb

Defined Under Namespace

Modules: ArrayConverters, BooleanConverters, DateTimeConverters, HashConverters, NumericConverters, RangeConverters Classes: Configuration, Context, ConversionTarget, Conversions, Converter, NullConverter

Constant Summary collapse

ConversionTypeError =

Raised when cannot conver to a given type

Class.new(StandardError)
NoTypeConversionAvailableError =

Raised when conversion type is not available

Class.new(StandardError)
VERSION =
"0.7.0"

Class Method Summary collapse

Class Method Details

.convert(*args, &block) ⇒ ConversionTarget

Convenience to directly call conversion

Examples:

Necromancer.convert("1").to(:integer)
# => 1

Returns:



35
36
37
# File 'lib/necromancer.rb', line 35

def convert(*args, &block)
  Context.new.convert(*args, &block)
end

.new(&block) ⇒ Context

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a conversion instance

Examples:

converter = Necromancer.new

Returns:



21
22
23
# File 'lib/necromancer.rb', line 21

def new(&block)
  Context.new(&block)
end