Class: TextExtractor::Record::FactoryAnalyzer
- Inherits:
-
Object
- Object
- TextExtractor::Record::FactoryAnalyzer
- Defined in:
- lib/text_extractor/record.rb
Overview
converts the value of the factory option to a constructor proc
Instance Method Summary collapse
-
#initialize(factory) ⇒ FactoryAnalyzer
constructor
A new instance of FactoryAnalyzer.
- #to_proc ⇒ Object
Constructor Details
#initialize(factory) ⇒ FactoryAnalyzer
Returns a new instance of FactoryAnalyzer.
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/text_extractor/record.rb', line 102 def initialize(factory) @params = nil case factory when Hash @klass, @params = factory.first else @klass = factory end end |
Instance Method Details
#to_proc ⇒ Object
113 114 115 116 117 118 119 120 121 |
# File 'lib/text_extractor/record.rb', line 113 def to_proc if @params explicit elsif @klass.respond_to?(:call) @klass elsif @klass implicit end end |