Class: TextExtractor::Value
- Inherits:
-
Object
- Object
- TextExtractor::Value
- Defined in:
- lib/text_extractor/value.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#re ⇒ Object
readonly
Returns the value of attribute re.
Instance Method Summary collapse
- #convert(value) ⇒ Object
-
#initialize(id, re, &block) ⇒ Value
constructor
A new instance of Value.
Constructor Details
#initialize(id, re, &block) ⇒ Value
Returns a new instance of Value.
5 6 7 8 9 |
# File 'lib/text_extractor/value.rb', line 5 def initialize(id, re, &block) @id = id @re = re @block = block end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/text_extractor/value.rb', line 3 def id @id end |
#re ⇒ Object (readonly)
Returns the value of attribute re.
3 4 5 |
# File 'lib/text_extractor/value.rb', line 3 def re @re end |
Instance Method Details
#convert(value) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/text_extractor/value.rb', line 11 def convert(value) @block ? @block.call(value) : value rescue => e raise e.class, "in custom conversion of "\ "value(#{id.inspect}, #{re.inspect}): #{e.}" end |