Class: Gorillib::Factory::ApplyProcFactory
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
#receive
Methods inherited from BaseFactory
blankish?, native?, #receive, #typename, typename
Constructor Details
#initialize(callable = nil, options = {}, &block) ⇒ ApplyProcFactory
544
545
546
547
548
549
550
551
|
# File 'lib/gorillib/factories.rb', line 544
def initialize(callable=nil, options={}, &block)
if block_given?
raise ArgumentError, "Pass a block or a value, not both" unless callable.nil?
callable = block
end
@callable = callable
super(options)
end
|
Instance Attribute Details
Returns the value of attribute callable.
542
543
544
|
# File 'lib/gorillib/factories.rb', line 542
def callable
@callable
end
|
Instance Method Details
#blankish?(obj) ⇒ Boolean
552
|
# File 'lib/gorillib/factories.rb', line 552
def blankish?(obj) obj.nil? ; end
|
#convert(obj) ⇒ Object
554
555
556
|
# File 'lib/gorillib/factories.rb', line 554
def convert(obj)
callable.call(obj)
end
|
#native?(val) ⇒ Boolean
553
|
# File 'lib/gorillib/factories.rb', line 553
def native?(val) false ; end
|