Class: Liquify::Parameter
- Inherits:
-
Array
- Object
- Array
- Liquify::Parameter
- Defined in:
- lib/liquify/parameter.rb
Instance Method Summary collapse
- #extract_options! ⇒ Object
-
#initialize(markup, context = {}) ⇒ Parameter
constructor
A new instance of Parameter.
Constructor Details
#initialize(markup, context = {}) ⇒ Parameter
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/liquify/parameter.rb', line 3 def initialize(markup, context={}) markup = markup.split(',') args = [] = {} markup.each do |arg| key, value = arg.split(':') key = strip_quotes(key.strip) if value value = (value =~ /("|')/) ? strip_quotes(value.strip) : context[value.strip] [key] = value else args << key end end args << unless .empty? super(args) end |
Instance Method Details
#extract_options! ⇒ Object
25 26 27 |
# File 'lib/liquify/parameter.rb', line 25 def last.is_a?(Hash) ? pop : {} end |