Method: Asset#initialize

Defined in:
lib/tags/asset.rb

#initialize(tag_name, markup, tokens) ⇒ Asset

Returns a new instance of Asset.

Raises:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tags/asset.rb', line 19

def initialize(tag_name, markup, tokens)
  super
  raise AssetError, 'Invalid layout syntax' unless markup =~ SYNTAX

  @path = parse_expression(Regexp.last_match(1))
  # This is defaulted to the pages dir, because it represents the structure
  # of our website. Asset directories are copied as siblings at runtime.
  @@root_dir ||= File.join(Dir.pwd, 'pages')

  @attributes = {}

  markup.scan(Liquid::TagAttributes) do |key, value|
    @attributes[key] = parse_expression(value)
  end
end