Module: HashEngine::Fetchers
- Included in:
- HashEngine, Transform
- Defined in:
- lib/hash_engine/fetchers.rb
Constant Summary collapse
- @@fetchers =
{}
Instance Method Summary collapse
- #add_fetcher(name, &block) ⇒ Object
- #fetcher(type, field_data, customer_data) ⇒ Object
- #fetchers ⇒ Object
- #valid_fetcher?(fetcher) ⇒ Boolean
Instance Method Details
#add_fetcher(name, &block) ⇒ Object
9 10 11 |
# File 'lib/hash_engine/fetchers.rb', line 9 def add_fetcher name, &block @@fetchers[name] = block end |
#fetcher(type, field_data, customer_data) ⇒ Object
17 18 19 20 21 |
# File 'lib/hash_engine/fetchers.rb', line 17 def fetcher(type, field_data, customer_data) if valid_fetcher?(type) fetchers[type].call(field_data, customer_data) end end |
#fetchers ⇒ Object
5 6 7 |
# File 'lib/hash_engine/fetchers.rb', line 5 def fetchers @@fetchers end |
#valid_fetcher?(fetcher) ⇒ Boolean
13 14 15 |
# File 'lib/hash_engine/fetchers.rb', line 13 def valid_fetcher?(fetcher) fetchers.has_key?(fetcher) end |