Module: TypeLib
- Defined in:
- lib/typelib.rb,
lib/typelib/canned.rb
Overview
Typelib is a way of checking and converting data. It operates as a “filter chain” system which allows it to gradually normalize disparate data into a common type. Each chain is optionally a part of a list which allows it to provide several paths in a single external execution.
The library is arguably very simple and therefore has simple requirements and needs. This is intentional.
Please see TypeLib::Filter and TypeLib::FilterList for more information.
Defined Under Namespace
Modules: Canned Classes: Filter, FilterList
Class Method Summary collapse
Class Method Details
.execute_filterlist(filters, obj) ⇒ Object
13 14 15 16 |
# File 'lib/typelib.rb', line 13 def self.execute_filterlist(filters, obj) f = filters.find { |filter| filter.check(obj) } f ? f.convert(obj) : obj end |