Class: Lookbook::TagOptionsParser
- Defined in:
- lib/lookbook/services/tags/tag_options_parser.rb
Constant Summary collapse
- RESOLVERS =
[ FileResolver, MethodResolver, EvalResolver, YamlResolver ]
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(input, resolver_opts = {}) ⇒ TagOptionsParser
constructor
A new instance of TagOptionsParser.
Methods inherited from Service
Constructor Details
#initialize(input, resolver_opts = {}) ⇒ TagOptionsParser
Returns a new instance of TagOptionsParser.
10 11 12 13 14 15 |
# File 'lib/lookbook/services/tags/tag_options_parser.rb', line 10 def initialize(input, resolver_opts = {}) @input = input.to_s.strip @resolve = resolver_opts.fetch(:resolve, true) @resolver_opts = resolver_opts.except(:resolve) @fallback = resolver_opts.fetch(:fallback, {}) end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lookbook/services/tags/tag_options_parser.rb', line 17 def call , remaining_text = parse_input(@input) if resolve? = resolver().call(, **@resolver_opts) = () [, remaining_text] else [, remaining_text] end end |