Parent

Methods

Included Modules

Less::Parser

Convert lesscss source into an abstract syntax Tree

Public Class Methods

new(options = {}) click to toggle source

Construct and configure new Less::Parser

@param [Hash] opts configuration options @option opts [Array] :paths a list of directories to search when handling @import statements @option opts [String] :filename to associate with resulting parse trees (useful for generating errors)

# File lib/less/parser.rb, line 49
def initialize(options = {})
  stringy = {}
  options.each do |k,v|
    stringy[k.to_s] = v.is_a?(Array) ? v.map(&:to_s) : v.to_s
  end
  lock do
    @parser = Less.Parser.new(stringy)
  end
end

Public Instance Methods

parse(less) click to toggle source

Convert `less` source into a abstract syntaxt tree @param [String] less the source to parse @return [Less::Tree] the parsed tree

# File lib/less/parser.rb, line 62
def parse(less)
  calljs do
    error,tree = nil
    @parser.parse(less, lambda {|e, t|
      error = e; tree = t
    })
    Tree.new(tree) if tree
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.