Module: Proletariat::WorkerDescriptionParser
- Defined in:
- lib/proletariat/util/worker_description_parser.rb
Overview
Internal: Helper utility to parse and constantize strings into arrays of
Worker classes.
Class Method Summary collapse
-
.parse(description) ⇒ Object
Public: Parse given string into array of Worker classes.
Class Method Details
.parse(description) ⇒ Object
Public: Parse given string into array of Worker classes.
description - String to be parsed. Should contain comma-separated class
names.
Examples
WorkerDescriptionParser.parse('FirstWorker,SecondWorker')
# => [FirstWorker, SecondWorker]
Returns an Array of Worker classes.
16 17 18 19 20 |
# File 'lib/proletariat/util/worker_description_parser.rb', line 16 def self.parse(description) description.split(',').map(&:strip).map do |string| constantize string end.compact end |