Class: Lookbook::PriorityPrefixParser
- Defined in:
- lib/lookbook/services/priority_prefix_parser.rb
Constant Summary collapse
- PRIORITY_PREFIX_REGEX =
/^(\d+?)[-_]/
Instance Attribute Summary collapse
- #input ⇒ Object readonly
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(input) ⇒ PriorityPrefixParser
constructor
A new instance of PriorityPrefixParser.
Methods inherited from Service
Constructor Details
#initialize(input) ⇒ PriorityPrefixParser
Returns a new instance of PriorityPrefixParser.
7 8 9 |
# File 'lib/lookbook/services/priority_prefix_parser.rb', line 7 def initialize(input) @input = String(input) end |
Instance Attribute Details
#input ⇒ Object (readonly)
5 6 7 |
# File 'lib/lookbook/services/priority_prefix_parser.rb', line 5 def input @input end |
Instance Method Details
#call ⇒ Object
11 12 13 14 |
# File 'lib/lookbook/services/priority_prefix_parser.rb', line 11 def call matches = input.match(PRIORITY_PREFIX_REGEX) matches ? [matches[1].to_i, input.gsub(PRIORITY_PREFIX_REGEX, "")] : [nil, input] end |