Class: BridgetownSvgInliner::LiquidAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/bridgetown-svg-inliner/liquid_attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ LiquidAttributes

Returns a new instance of LiquidAttributes.



7
8
9
10
11
12
13
14
# File 'lib/bridgetown-svg-inliner/liquid_attributes.rb', line 7

def initialize(attributes)
  path, args = attributes.split(",", 2)

  @path = unescape_string(path)
  @args = args.scan(%r{([a-zA-Z0-9_\-]+)\s*:\s*(#{Liquid::QuotedFragment})}o).map do |arg|
    [arg[0], unescape_string(arg[1])]
  end.to_h if args.present?
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/bridgetown-svg-inliner/liquid_attributes.rb', line 5

def args
  @args
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/bridgetown-svg-inliner/liquid_attributes.rb', line 5

def path
  @path
end