class TextExtractor::Value

Attributes

id[R]
re[R]

Public Class Methods

new(id, re, &block) click to toggle source
# File lib/text_extractor/value.rb, line 5
def initialize(id, re, &block)
  @id = id
  @re = re
  @block = block
end

Public Instance Methods

convert(value) click to toggle source
# File lib/text_extractor/value.rb, line 11
def convert(value)
  @block ? @block.call(value) : value
rescue StandardError => e
  raise e.class,
        'in custom conversion of '\
        "value(#{id.inspect}, #{re.inspect}): #{e.message}"
end