Module: Gorillib::Factory
- Defined in:
- lib/gorillib/type/url.rb,
lib/gorillib/factories.rb,
lib/gorillib/type/extended.rb
Defined Under Namespace
Classes: ApplyProcFactory, ArrayFactory, BaseFactory, BignumFactory, BinaryFactory, Boolean10Factory, BooleanFactory, ClassFactory, ComplexFactory, ConvertingFactory, DateFactory, EnumerableFactory, EpochTimeFactory, ExceptionFactory, FactoryMismatchError, FalseFactory, FloatFactory, GraciousFloatFactory, GraciousIntegerFactory, GuidFactory, HashFactory, HostnameFactory, IntTimeFactory, IntegerFactory, IpAddressFactory, ModuleFactory, NilFactory, NonConvertingFactory, PathnameFactory, RangeFactory, RationalFactory, RegexpFactory, SetFactory, StringFactory, SymbolFactory, TimeFactory, TrueFactory, UrlFactory
Constant Summary
collapse
- IdenticalFactory =
::Whatever
- FLT_CRUFT_CHARS =
In the following, we use eg Float(val)
and not val.to_f
--
they round-trip things
Float("0x1.999999999999ap-4") "0x1.999999999999ap-4".to_f
',fFlL'
- FLT_NOT_INT_RE =
/[\.eE]/
Class Method Summary
collapse
Class Method Details
.factory_for(type, options = {}) ⇒ Object
29
30
31
32
33
|
# File 'lib/gorillib/factories.rb', line 29
def self.factory_for(type, options={})
return find(type) if options.compact.blank?
klass = factory_klasses[type] or raise "You can only supply options #{options} to a Factory-mapped class"
klass.new(options)
end
|
.register_factory(factory, typenames) ⇒ Object
35
36
37
|
# File 'lib/gorillib/factories.rb', line 35
def self.register_factory(factory, typenames)
typenames.each{|typename| factories[typename] = factory }
end
|
.register_factory_klass(factory_klass, typenames) ⇒ Object
39
40
41
|
# File 'lib/gorillib/factories.rb', line 39
def self.register_factory_klass(factory_klass, typenames)
typenames.each{|typename| factory_klasses[typename] = factory_klass }
end
|